Code Reader

Writing code is fun. Period. If someone tells you otherwise, they’re probably lying, frustrated, or gatekeeping (combinations are a possibility.). However, as any skill you can develop in life, you have to be conscious about the environment and the requirements of that particular environment.

I began writing code when I was around 12 years old and it captured me right away. Maybe it was because of the endless possibilities that became available within my reach immediately but, most likely, it was because I became a useful element for my friends and family. Those days were just the best, sitting on my computer entire afternoons playing videogames (roller-coaster-related ones being my top choice), writing silly C programs and just loving getting to know better the machine in front of me.

Programming is one of those things that change the way you think and see the world around you. Think of it like learning music, it doesn’t matter which instrument (or instruments) got you into the initial learning, you eventually find yourself getting a dramatically different idea of how and why you hear sounds around you, the order they have and the multiple, perhaps endless, permutations you can get just with a few simple notes. With music, you get to know things like time and sound, and how both concepts are correlated within the context of a musical piece and its execution.

Well, in programming we probably can’t create those funky, crazy, sticky, lovely beats (Or can we?) but we have our own set of appreciations and preferences towards code and computer programs. The sole concept of perfect code should be something that every programmer must know to avoid and, in my personal case, learn to let go.

For many years, I made the horrid mistake of not asking questions. Mostly because my code looked awful and, as a C fanboy, the bar was pretty high in terms of computer science and engineering. Have you looked at the Linux Kernel codebase? If not, you totally should! Those guys managed to create an entire set of computational tools with impressive modular mechanisms that allow it to scale from small devices like phones, to monumental (and historical) space shuttles and, even, some modules in the international space station itself. Says something about software’s inherent relevance for humanity, huh? And, yes, most of it used to be1 written in C.

The funny thing about it was that, in essence, I was reading code all the time. And not just some random code, but “serious” C code I couldn’t understand (and for the most part: still can’t) that was so imposing and complex it managed to scare more than one of the wonders of computer programming. However, in my case, I saw that code as some Rachmaninoff’s piano music sheet: complex, challenging, clearly written without caring for the person reading it but, most importantly, with something to teach you.

Rachmaninoff: Piano Concerto No. 3 fragment music sheet

This is a fragment from one of my favorite pieces from Rachmaninoff: Piano Concerto No. 3, with just the right amount of complexity.

It is difficult to get a lesson out of complexity. Even worse, you can easily get tricked into thinking of complexity as some sort of indicator of the underlying quality of something. The key is learning how to read complexity itself. Not just reading what you have in front of you, but reading what is not in front of you. It’s delusional to think of disciplines like programming as one were you “just need to write code”, as it would be to “just play your instrument” in music. The disparity between learning to do something and learning to improve something is so difficult to assess within your personal ego that you may even throw away useful conclusions just to follow the “just need to keep doing it” rules.

All those complex code is being changed nowadays. It is being analyzed, erased, rewritten and refactored. Not because the programmers were wrong, or their code was not working as it should, but because we (all of us) understood that removing complexity was an overall progressive step towards inclusive, likeable, invitational and general cohesive communities. And you may now quit reading this article and shout: “What an idiot! There are inherently complex systems!”, but spare me a few more words if you had, at least, felt identified by some concepts in here.

Oh yes, there was, there are and there will be non-simplifiable systems. No doubt about it. Programming is about modelling the world around you and the world ain’t simple. But the thing about the complexity I am talking about is that it is self-imposed.

In music, adding complexity is up to the composer, and it may improve (or not) the overall piece into achieving the feel and exact essence of what the musician wanted to include in their masterpiece. It may be applauded, it may not. If you ask experienced musicians about this, most of them will use an intermediary concept between complexity and greatness: “elegance”, to refer to the ability of adding and removing the exact amount of complexity. The same goes with programming.

Those thousands of lines of cryptic C code taught me a lesson that, over time, defined how I write and think about code. Programming is, for the most part, a journey where you get to read billions of lines of other’s people code. Whether they’re simple applications or complex corporate ERPs, you are going to read them. Me, I consider myself a purist in terms of coding, not because of the code I like to write, but because of how I like to read code. And when you start writing code in the way you’d like to read code, that’s when analytical, logical and overall elegance kicks in. You are no longer an agent of chaos, but a simple, hard-working, friendly human being that acknowledges code as what it is: a language.

In the particular context of computer programming, languages are there to riddle away the complexities of computers which, in the hardware and peripheral levels, tend to just increase over time. There are languages which are better suited for some tasks than others and all of them have do’s and don’ts based on the specific design choices made by the creator(s). Perhaps we are just writing code, but the unique certanity about programming is that the more code you read, the more conscious you are about the abstraction techniques and capabilities of each language and how, when, why and where to apply them.

You may, if you persist enough into this awesome and fun and exciting path, get to read some of your old code some day and say: “Well, at least I get why is written in this particular way”. Over time, you will get better at writing code, no doubt about it but keep pushing towards readability, not just because some random dude on the internet is telling you so, but because computers definitely won’t care about indentation, style, comments, variable naming or elegant implementations but maybe some 12 year old will read your code and learn something, your code will always be an example, it’s your choice for it to be a good one, or a refactoreable one.

As always, thanks for reading. For comments and feedback, you can find me on Twitter as: @humbertowoody.

  1. You can take a look at Rust and how it has been helping the software industry with a secure and modern paradigm in their official site: