Refrigerator Code

The late George Carlin once joked about the foolishness of human ingenuity. He said that, in the past, humans built houses to shield themselves from the cold. A warm enclosure inside of the cold outdoors. But then our food was too warm, so we built a refrigerator. A cold enclosure inside of a warm enclosure. But then the butter was too hard. So we built a refrigerator compartment for it. A warm enclosure inside a cold enclosure... (you can see where this is going).

When worded this way, the inefficiency of these progressions becomes hard to ignore. With each solution emerged another problem. With each new problem, we created another layer of complexity.

Unfortunately, this problem is not unique to the refrigerator.

As engineers, we are constantly exposed to new platforms and frameworks. None are perfect. With each handy new toolset, we stand to complicate something that was previously clear. Over the past decade, we have added layer upon layer to our web stacks, growing ever closer to the software equivalent of a butter bin inside the refrigerator.

Everything should be as simple as possible, but not simpler

  • Albert Einstein

How many times have you worked with the web client nesting dolls? Where we create an HTML file that includes a JS file that returns large amounts of HTML in strings? While there is often an argued need for this approach, developers rarely consider the future implications. As we architect code in this way, we often increase complexity.

When a developer new to a system hunts for code, they will start by looking where the code "should" be. When that code is someplace else, it causes confusion. Confusion is rarely a quality desired in a developer tasked with producing maintainable code. When confused, developers take longer and have a higher bug injection rate.

Realistically, the goal here is to keep our architecture as simple as possible. The simpler something is, the less likely it will break in unexpected ways. Remember that clients will not care wether you are using Angular, Rails or raw PHP.

So what is there to be done? Little, i fear. Asking someone to give up their JS templates is akin to asking them to part ways with their fridge. But to opponents of these ideas, i'd say this: there are millions of people without refrigerators today. And i'd be willing to bet more food spoils in my fridge than on their shelves.

So the next time we brag about what is gained, perhaps we should pause to consider what as been lost along the way.

Get the latest posts delivered right to your inbox.
Author image
Written by Ben
Ben is the co-founder of Skyward. He has spent the last 10 years building products and working with startups.