Software is a new thing to us, humans.
Behind every technology that changed the world, software was there in some way. Since its applications are so vast, let us define it in two major groups:
Code in which the final product is itself, like an app or a system — and code in which the final product is something else, like a scientist writing code to calculate physical properties, or engineers trying to predict the path of a robot in a field with obstacles. This type of code has a much closer relation to math.
This article focuses on the first type of code, where software is the final product of itself.
We, programmers, have been taming and wrangling with increasing software complexity for decades now. We were able to achieve efficiency at it, but at the cost of pain from which we learned precious lessons, as with all processes of iterative evolution.
The people that carried out these efforts have written books so that we can learn from their experiences. And we also learn this (or should be learning) every week by having intelligent coworkers and friends that we can turn on to for advice.
The consensus seems to be to avoid codebases that are hard to understand and annoying to maintain, or you end up with a codebase that after one year everyone wishes they could throw away and start over – and if you’re lucky to be able to do that, we often repeat the same cycle.
We know we need to write good code, but how can we do that?
Here we enter into a gray field where coding intersects with art — or, more intimately, into what makes us unique as human beings.
What one person thinks it’s good might be madness to another. But as with a lot of things in this world, we need to elect what we believe, one way or another.
For that, we can look at the two major code philosophies: Typed code and untyped code. Typed code commits itself to a level of precision that is more exact. They enforce that data is exactly what they expect at all times, which helps reduce unnecessary checks and make the code more deterministic.
On the other hand, the untyped code relies on type-juggling to write a code that just works without going too deep into the unnecessary details.
“Simplicity is the ultimate sophistication!” – the untyped person proclaims.
“You are being simplistic!” – the typed person replies – “You are dealing with complex issues as if they were simple, by simply ignoring important parts of the problem! Yes, of course it will work! But wait until the Wolf comes blowing at your little house and see it all fly away! You gotta build SOLID, like ME!”
As with a lot of discussions that are happening today at humanity, the tragedy is that they are both right, but extremists – and extremism is never good.
As for what good code looks like, I’ll leave it for each one to seek it for themselves — I couldn’t dare define it, or I would be limiting human creativity.
The most fun part of being a developer is unleashing our minds into a creative problem, I hope we can all spend more time doing this than just wrangling with the code.
In the photo in the cover: Arthur Mitchell (1934 – 2018)