Only One Life to Think

If you look at a piece of code and have to use your brain to understand what is going on, there is something terribly wrong with it.

It should read like a book.

A page turner.

Somebody said that the only measurement for code quality is WTFs/minute. When you’re reading code, how many times do you stop and think, why is it written this way? Every time this happens, the brain cycle is interrupted and re-routed into a subroutine. When it is processed, you need to store the result in the temporary memory, and continue reading. We have all been there, we have all experienced the memory overflow.

An interesting idea is described in Outliers. An excerpt can be read here. Humans have a memory loop which can store about 2 seconds of data. Chinese speakers have a major advantage when it comes to maths due to short pronunciation of their numbers. They can simply memorize more numbers. When doing even the simplest equations, we use that short term memory.

Some 10 years ago we used forums to solve programming problems. Stack Overflow has improved it by giving a solution where we don’t need to think. Literally, it takes 2 seconds to scan the answer and determine whether it applies to what you are searching for. All the users abide by simple rules, and as a result we have a tool that most programmers can’t survive without.

The expectation isn’t that the code would be easily understood by a 5 year old, or by any other non-programmer. Just the same as the proof of Fermat’s Last Theorem isn’t an afternoon read for a non-mathematician. We have to be the professionals of software engineering, we need to be in the driver’s seat and create the rules.

The limitations of our brains should humble us. We are not computers, so we must write code accordingly. Considering that our code will be read over and changed multiple times, perhaps hundreds, the brain cycle waste is too ridiculous. Our goal is not to be professionals of bad code.

They say that there is demand for more programmers. Ironically, we are a resource that is wasted every day. This, of course, is neither anything new, nor only applicable to the IT industry. What hurts, however, is that not enough effort is made, which means there is a lack of awareness, which can and will change.

There are plenty of other things to think about.