Low bug count, good performance, easy modification. Good code is high-impact, and is perhaps the main reason behind the existence of the proverbial 10x developer. And yet, despite it’s importance, it eludes new developers. Literature on the subject usually amounts to disconnected collections of tips. How can a new developer just memorize all that stuff? “Code Complete“, the greatest exponent in this matter, is 960 pages long!
I believe it’s possible to construct a simple mental framework that can be used with any language or library and which will lead to good quality code by default. There are five main concepts I will talk about here. Keep them in mind and writing good code should be a breeze.
Update: Mia Li was kind enough to offer a Chinese translation of this post here.
Keep your personal quirks out of it
You read some article which blows your mind with new tricks. Now you are going to write clever code and all your peers will be impressed.
The problem is that people just want to fix their bugs and move on. Your clever trick is often nothing more than a distraction. As I talked about in “Applying neuroscience to software development“, when people have to digest your piece of code, their “mental stack” fills up and it is hard to make progress.