The Zen Programmer

Any profession where you need to write code is one where you are always striving for perfection. Being human gets in the way of attaining perfection, so failure happens, often. In that sense, programming professionally is a very religious experience that requires devout discipline in order to achieve a state of enlightenment.

Read More

To PhD, Or Not To PhD

I went through the university system with the very unspecific goal of ‘becoming an engineer’. After getting an undergraduate and masters degree in Electrical Engineering, I travelled to the Netherlands, crossed into Mechanical Engineering (emphasis in Control Theory), and earned a PhD. Returning back to the Bay Area, I thought my chances at receiving a job offer as an engineer were good.

Read More

Setting Up Your Linter In Sublime

Linters are time savers. They help spot syntax errors, undeclared variables, and make your code look consistent. This post will walk you through setting up a JavaScript linter that follows the popular Airbnb style guide in Sublime 3 (here is the Airbnb guide definition). Specifically, I will walk through installation of Package Control, SublimeLinter-jscs, SublimeLinter-jshint and Trailing Spaces.

Read More

For Loop With Asynchronous Functions

A very common web development task is to loop through an array and call an asynchronous function. For example, the array contains query parameters and a series of API calls need to made, saving the result into a database. A potential problem with simply wrapping your asynchronous functions call in a for-loop is that the asynchronous calls will likely be completed out of order. So if one asynchronous call depends on the result of the one before it, then chaos ensues. Another drawback to this for-loop strategy, is all the asynchronous calls are fired immediately after one another. This might be a problem if there are some API usage restrictions. In this post, I will explain how to iterate through an array of data and call an asynchronous function such that they are called in order, with a specified delay.

Read More

The Square Root Is Never Negative

At some point in your beginning algebra class, you were taught that taking the square root is the way to ‘undo’ squaring a number. Although seemingly trivial, this is not exactly true. This happens to be one of the more confusing topics is that frequently glossed-over. Most students just memorize a square root’s two main properties, and move on. Those properties are (i) it is used for finding when given and (ii) it always outputs a non-negative value (given a non-negative input). But there are some subtle details to be mindful of, and an interesting functional composition behind its existence.

Read More

Simple Is Hard - Tips on Presenting Solutions

Engineers solve problems. Finding a solution is only a small part of the work. The more challenging aspect is conveying your solution to others and convincing others (colleagues/peers) that your solution is the ‘best’ for your particular problem. I have given a handful of presentations at engineering conferences, and have been in the audience for many others, so I thought I would give my two cents on the matter.

Read More

Debugging Tree Traversals

Software engineers often have to write code that searches through a tree data structure. At some point, a bug will present itself, and you (the software engineer) will need to figure it out quickly. Tree traversal algorithms are commonly written recursively, which are inherently painful to debug (especially if it is not your code). There are always a few questions that should immediately come to mind when debugging tree traversal/search algorithms:

Read More

The Web is a Forest, Not an Ocean

It is very common to hear people describe navigating the web as ‘surfing.’ This verb seems to imply that the web is an ocean. An ocean analogy does convey the vastness of the web, but does not convey the structure (as liquids are amorphous). The web is more like a forest than an ocean. Why a forest? Because the web is full of trees:

Read More