When first learning programming, I was very pleased by what seemed to be the inherent objectivity of code. Everything appeared to be very black and white, cut and dry, yes or no. I totally understood that there were many different ways to approach any given problem, but ultimately either your unique approach worked or it didn’t — there was no in-between.


My first encounter with how subjective programming can be came when I started to truly learn about inheritance. I say ‘truly’ because I first learned about class constructors when I taught myself Python and my genuine impression at…

When first learning how to program, a lot of the projects you start with are already halfway finished. You might be learning from a Udemy course that gives you a default file structure, or maybe you’re enrolled with a Bootcamp that frequently starts you off with some pre-written code in an IDE. You’re comfortable working on a partially-competed project, but when you yourself have to create everything from scratch, you’re not always exactly sure how to light the fuse. This is a step-by-step guide for how to generally go about building a basic Rails API from scratch. …

Understanding the problem

One of the more common problems you might encounter in a software interview involves finding what is commonly referred to as the “maximum sub-array” within a longer array. Take a look at this example here:

We want to write a function that looks at an array and discovers which slice or segment of that array contains a series of numbers that adds up to the largest possible sum.

Since we didn’t specify how long our sub-array needs to be, the maximum sub-array is actually the entire array itself!

How Does JavaScript Run?

How Does Function Execution Context Work?

I applied for a company this week that was hiring for a Python position. Python was the first language I ever learned and I felt very comfortable with the syntax, but I hadn’t yet used it to build a project. I got in touch with one of their employees who told me that the company would consider me if I was able to build a project with Django by the time they started kicking off interviews.

While I didn’t wind up getting the interview, I did take him seriously and whipped together a basic polling app over the next couple…

Example of a simple JavaScript Immediately Invoked Function Expression that logs “Hello World” to the console

I’ve encountered the term Immediately Invoked Function Expression (IIFE) a ton while preparing for my interviews. Initially it was very frustrating — every time I googled something like “Top 100 JavaScript Interview Questions” the topic would come up, but I could never find enough real-life implementations to understand the use cases.

For anyone who isn’t familiar with the term, an IIFE is just a way to create a module in JavaScript. To fully understand modules and why they’re useful, we first need to understand global scope and why it behaves differently in a file than it does in a browser.

Global Scope

I’ve been obsessed (in a healthy way) with figuring out how to use my time in the most efficient way possible for as long as I can remember. Sometimes “work smarter not harder” is more easily said than done — there are a number of variables that can throw off your groove on any given day. Not to mention there comes a point where nothing substitutes reps and plain old hard work. That said, I still love having structures and systems that allow me to squeeze the most productivity out of my hours.

This article aims to answer one question:

Once upon a time, there was a magic bridge

The magic bridge was made up of round, magic stepping stones, and each magic stepping stone had a magic rope connected to it that pointed in one direction. The magic bridge had two rules that you always had to follow if you wanted to travel across it:

  1. You can only walk along the magic rope in the direction that it is pointing
  2. The magic bridge will continue on forever until one of the magic ropes points to an “end” sign.

One day, two engineers were standing at the entrance to the…

Let’s talk data

In JavaScript, there are seven “primitive” data types…

String, Number, Boolean, BigInt, Symbol, undefined, and null

… and two “structural” types…

Object and Function

As you probably already know, each data type has some inherent functionality. For example, a string can tell us how long it is if we simply ask it about its “length” property.

We’ll be doing a step-by-step breakdown of three famous sorting algorithms. While they aren’t the most optimal sorting algorithms regarding time complexity, understanding how they work can help tremendously with mastering common problem-solving techniques such as sliding-windows and multiple pointers.

Before go into each specific algorithm, let’s first go over the two things that all three of them will share in common.

Commonality one: Sorting an array in place

Take a look at the reverseArray function below:

This function takes in an array as an argument, initializes an empty newArray and iterates backwards over the argument array by using a for loop. …

Spencer Smith

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