William Blankenship
Filter: February
Simplifying flow with early returns

I spend most of my time reading and modifying code, only a small portion of it writing code from scratch. When I break ground on new code, I spend quite a bit of time trying to reason about how understandable it's structure will be to future programmers (myself included!).

I feel a program should read like a story - line by line it should tell you what the program is going to do when it runs. The closer I can bring my code into being a linear set of steps that I can follow from top to bottom, the easier it will be for me to grok in the future.

Take this trivial function for example:

async function loadConfig() {
  const [ error, config ] = await readYaml('./config')
  // If we didn't run into an error, try parsing the config
  if(!error) {
    // Parse wibbles
    for(let i = 0; i < config.wibbles.length; i++) {
      // Is the wibble a wobble?
      if (isWobble(config.wibbles[i])) {
        config.wibbles[i] = parseWobble(config.wibbles[i]);
      // Is the wibble a ruble?


A running list of notable books I've read and why I liked them.

Why We Sleep: Unlocking the Power of Sleep and Dreams

The title sets off the pseudoscience alarm bells - but this book is anything but. A research backed heavy hitter straight out of Berkeley's Center for Human Sleep Science lab, Why We Sleep dives deep into what sleep does for the body and how to get the most out of it.

I grew up in the culture of hackathons - sleepless, junk food fueled, "innovation" sprints. Reading this single-handedly convinced me to give up that life. It's amazing how valuable sleep is and how unaware humans are of their degraded state when skipping sleep.

When it comes to the importance of sleep, you don't have to take their word for it; this contains practical advice for improving your