Code Simplicity by Max Kanat-Alexander is a thought provoking book on improving software code quality. As with many “philosophical” books (i.e. books not aimed at a specific technology) on software development the advice given here is not “hard and fast” and should not be considered as “rules” but rather as “guidelines” that developers should think about when writing code within their own context.
The book’s main theme is on the three flaws of software design.
- Writing code that isn’t needed (YAGNI)
- Not making the code easy to change
- Being too generic
These three flaws have some conflicting aspects and I think the developer needs to find the right balance. The author himself talks about these flaws in this great 4 part series on YouTube. I suggest watching these short videos if you don’t want to buy the book (or perhaps buy the book after watching them :))
There are many other useful advice in the book such as;
It is more important to reduce the effort of maintenance than it is to reduce the effort of implementation
Never “fix” anything unless it’s a problem, and you have evidence showing that the problem exists
The ease of maintenance of any piece of software is proportional to the simplicity of it’s individual pieces
Strangely to me (call me nuts ;)) the most simple but most important line in the book was not about code quality itself, but rather the author’s answer to the question “What is the purpose of Software?”
The purpose of software is to help people….”not to make money” or “show people how intelligent I am”
Software developers (including yours truly) often ignore or forget this basic fact when designing and implementing software products. This most often results in a complex, over-engineered product that makes simple things hard for the end-user.