Asynchronous JavaScript with async/await

In this course we will learn how to use the ES2017 async and await keywords to write asynchronous code that is more readable and easier to follow than equivalent code based on long promise chains or deeply nested callbacks.

Watch the Course

Open Loops Cause You to Be a Worse Programmer

Programming is difficult. It's an activity that normally requires a lot of concentration. When we write code, we should be deeply focused and reason about it at different abstraction levels. We need to pay attention to the details of the code lines directly in front of us, while at the same time keeping in mind the bigger picture of the piece of software.

The Zone

Every programmer has probably experienced that feeling of uttermost concentration and focus several times. We call it the zone or the flow, a state which we usually try to get ourselves into as often as possible.

For me, it helps a lot to put on noise-cancelling headphones and listen to music to quiet my surroundings. Albums like Random Access Memories or the TRON soundtrack work best for me. Of course, your mileage may vary.

Once we're in the zone, we've created a detailed mental model of the part of the system we're currently working on. We know how it works. We see how different components play together. We understand.

Interruptions

Unfortunately, that image in our head is a fragile thing easily shattered. Just like a house of cards, it collapses all of a sudden when we're interrupted. It usually takes a significant amount of time to get back into the zone after being disrupted.

The problem I see is that these interruptions don't have to be external; they can be internal, too. It's possible for us to distract ourselves by having unfinished thoughts in our head to which our attention drifts off from time to time.

Similar to a computer processor, we incur a productivity penalty when switching between different tasks, so we should really be striving to get rid of these distractions.

Open Loops

In Getting Things Done, a fantastic book about personal productivity and self-management strategies, David Allen calls those thoughts open loops:

Anything that does not belong where it is, the way it is, is an "open loop" pulling on your attention.

I firmly believe this to be true. Unprocessed or unorganized thoughts consume brain power, at least on a subconscious level, that could be used otherwise.

If it's on your mind, your mind isn't clear.

Our mind is trying to hold on to these things, thus negatively impacting our ability to channel our focus and concentration on the programming task in front of us.

The Trusted System

David Allen suggests to build what he calls a trusted system to keep track of and free your mind from all these things:

Anything you consider unfinished in any way must be captured in a trusted system outside your mind, or what I call a collection bucket, that you know you'll come back to regularly and sort through.

The idea is that you can rest assured that you won't forget anything if you've created a personal place for your thoughts and to-do items. Once you've gotten into the habit of putting all open loops into this organization system and reviewing them on a regular basis, you can relax because you know you won't forget any of them.

After reading Getting Things Done, I started to write down pretty much every actionable item that popped into my head, and I learned to deeply appreciate this system. It now helps me focus on one task and one task only. Despite a growing number of commitments and responsibilities, I can finally be a more efficient programmer again.

Learn Node