Using TDD to improve your code and the Software Development LifeCycle

TDD’s upsides

If you have been researching the QA side of software development, you have most likely come across articles singing the praises of TDD. There is no shortage of leaders in the industry applauding the upsides of integrating TDD into coding. Many companies are making a shift to the “TDD paradigm” if they haven’t already. So, does it live up to the hype?

As a developer who has applied TDD in my own personal projects, I can attest to definite upsides to a TDD approach. In many ways, this philosophy…

Finding the shortest distance between two points

Photo by Denys Nevozhai on Unsplash

Ever wondered how google maps calculate the shortest path to your destination? This is the problem it must solve every time you search for the nearest Italian restaurant or the quickest route to visit your family.

The app obviously needs your geolocation, destination, and a mapping of the road/interstate highway system in your area to complete this task. From a hardware perspective, this problem requires a global satellite system with real-time ground communication.

This leaves a question. On the software side, how does it calculate the fastest path from the given data? This is especially challenging given the number of…


Divide and Conquer Sorting

Photo by Sergi Viladesau on Unsplash


In 1959 British computer scientist Tony Hoare developed the QuickSort algorithm. He came up with the idea while visiting Moscow state university when he was tasked with alphabetically sorting Russian words to look up in a Russian-English dictionary.

Quick Sort is similar to many “divide and conquer” algorithms both in function and performance. If you are not familiar with recursive divide and conquer type algorithms, I advise you to review my previous article on merge sort. Grasping merge sort is a good stepping stone to mastering quick sort as their foundations are similar.

Quick sort’s procedure consists of three basic…


Divide and Conquer Recursion

Photo by Steve Johnson on Unsplash


In 1945 John von Neumann, the Hungarian mathematician, physicist, and computer scientist, developed the merge sort algorithm. Merge sort is a general-purpose sorting method that uses a ‘divide and conquer’ approach. It was developed to address weaknesses in less efficient algorithms such as bubble sort. It is the classic example of a recursive bottom-up ‘divide and conquer’ algorithm in many ways. Despite this, a top-down looping approach is possible. For this article, I will explain merge sort with the former perspective.



Find All the Permutations of a Set of Elements

A classic technical interview question is finding the permutations of characters in a string. This is a subset of a larger problem of finding all the permutations of elements in a set. One of the most common algorithms to tackle this problem is Heap’s Algorithm. Heap’s is a relatively young algorithm being first proposed by B. R. Heap in 1963.

I’ve laid out the algorithm's pseudocode with explanation below:

IF n == 1 THEN
process S
FOR i := 0…

Finding Prime Numbers from 1 to n

Sieve of Eratosthenes is one of the most ancient algorithms dating from the 2nd century in ancient Greece. Old does not mean obsolete, however. This algorithm is still relevant today, being a space and time-efficient way to find prime numbers. The idea is straightforward and depicted in the grid below.

Algorithm Explanation

source: Wikipedia

Say we have an integer input. It could be any natural number, big or small. Our task is to find all the prime numbers from one to this integer. Let’s take a simple example: 23. First, let’s write out all the intermediate integers.

Brief Overview

What is object-oriented programming?

Another trick in software is to avoid rewriting the software by using a piece that’s already been written, so called component approach which the latest term for this in the most advanced form is what’s called Object-Oriented Programming.
-Bill Gates

Object-oriented programming has been around since at least the 1960s. The first generally accepted object-oriented programming language was Simula, developed in 1967. Since then, the “object-oriented paradigm” has taken over computer science. Nearly every modern programming language is considered object-oriented or heavily influenced by object-oriented principles. …

cryptocurrencies and how they work

Wikipedia Commons

I have been fascinated by cryptocurrencies for a while now. It is an understatement to say they have a mixed reputation. Opinions about them range from unending praise to scorn. Some say they will usher in a new age overturning old economics. Others believe they are a Ponzi scheme only used by drug dealers that will destabilize national economies. I look at them as a fascinating space that could potentially change how people interact and relate with each other in the marketplace.

Whatever you think about them, I’d like to give you a brief introduction…

Two underrated data types

Maps and sets are two underrated javascript data types. Many javascript developers rely on arrays and traditional objects when solving problems. However, they often overlook these two gems which I have learned can be incredibly powerful. I’ll briefly explain maps and sets and give simple examples to give you an introduction.


source: Wikipedia

A set is a collection of values of any data type. Unlike arrays and objects, each of the values in a set must be unique. Also, unlike arrays and objects, the values of a set are not accessible directly by key. The set’s values are…

searching from root to leaves

The depth-first search algorithm is a handy algorithm highly applicable to a wide variety of computer science problems. This algorithm involves searching through a sequence of nodes in a tree or data structure. However, unlike a breadth-first search, a depth-first search follows a different pattern. In the depth-first search pattern, the algorithm goes ‘deep’ instead of ‘wide.’ In other words, it searches for a path from the root node to the lowest leaf before moving onto the next possible path.

Depth-First Search Graphic

The animation above shows the flow of depth-first search. The algorithm finds all paths from…

Adam Shaffer

A full-stack software developer who likes writing about tech.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store