How to program

In this talk, Justin Searls breaks down the basic process a programmer follows while coding. Suppose we have a big, very complex problem. So much complexity scares us, we feel overwhelmed. So it’s much better to not tackle all at once.

Bottom-up programming

Let’s break the problem down into its parts by asking, what do I need for the resolution of this problem? Once you have an idea, start coding on the first one of those components. Once you work on it, you suddenly realize, Oh! This thing actually won’t align with the other component I need. So you make adjustments and redesign.

The problem with this approach is that you are doing redundant work without knowing it. Once you realized you implemented something wrong, you’ve already done it. The blinders work to overcome our paralysis by focusing on one small part of the problem first, but the blinders also make us work inefficiently.

Justin realized that and now takes another approach. He works top down instead of bottom up.

Top-down programming

You start with the entry point of the problem you want to solve, for example, you want to authenticate a person. Then you can ask, what do I need? Well, I need this and this.  When your brain is focused in such a way that less waste is generated, you know the basic requisites you need to accomplish and you know what can be omitted.

But the problem of being overwhelmed still persists with this approach. So we need to solve our fear by breaking things down in a systematized way. The method Justin uses to accomplish this, he calls discovery testing. It works by writing a test for the top level thing.

The he asks the crucial question, what’s the code I wish I had that I could hand this work out to?

Let’s write the outline of all the tests of all the code we wish we had to solve our problem. See what happened? Instead of one big scary thing, we now have a series of solvable problems.

Personal Comments

I’m so glad that I found this talk because this year I discovered by myself that a top-down thinking process works much better for me while programming. The sad thing is, they never taught us any of this in school. The thinking process of programming should be the first thing taught at computer science and coding classes.