Superpower
Let's face it, us developers live in a very strange world. Explain what you do to 95% of the population and they'll likely glaze over before you've finished your sentence. What you do with a computer day-to-day looks like bloody wizardry to most people, and so it should, programming is a superpower.
It is a superpower that needs careful thought and consideration, particularly for those programmers who are going to have to read your code later.
Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.
The one book I wish every programmer before me had read before writing that 3000 line function is Clean Code - Robert C. Martin.
Why Clean Code
This book gave me a whole new perspective, it has restructured the way I think about each line of code. It made me realise that there is an art to being a software engineer.
It teaches:
- How to identify bad code
- How to meaningfully name variables/classes/functions
- How to write clean, small, single-purpose functions
- When to comment, or rather, when not to comment
- Guidelines to formatting code properly
- Using objects and data structures for appropriate data abstraction
- How to properly follow the laws of TDD and write clean tests
- Elegant ways to handle errors
- Endless refactoring tips
- 67 smells and heuristics (Yes, I counted.🤣)
And much, much more.
Whenever I'm programming I have Clean Code an arms reach away as a reference. The book has tonnes of examples of transforming bad code to clean code and the step by step process on how to get there.
For instance, just the other day I was refactoring a function which violated the single responsibility principle on numerous counts and was scratching my head on how to split it up properly. I consulted the book to jog my memory on an efficient way to get about the process and there was an example exactly like my problem, the only minor difference really being the context.
Uncle Bob
Robert C. Martin (Commonly known as Uncle Bob) is a programming superstar. Not only does he write absolutely brilliant books he is also a very talented speaker. Just YouTube "Uncle Bob" and you'll find a stream of talks he's done, each of them as interesting as the next.
His blog is also one of my favourites to read with some pretty accurate quotes:
Finally
In my opinion, every programmer should read this book, at least 3 times 😄. It'll give you a whole new love for programming. You'll actually begin to understand when you're writing bad code. You'll look at your old code and wince at its structure, the vertical spacing, the complexity, the out of sync abstractions, the useless comments, and the spaghetti nature. (well, I do, every-single-day). In the book, the code snippets are in Java but the same rules apply to most languages!
This blog is only a brief introduction to the benefits of reading this book, I strongly recommend you have a read if you haven't already. I'd love to hear your thoughts on Clean Code and potentially how it changed your perspective. I'd also love to hear of some other books which have completely altered the way you look at code.
Follow me on twitter if you don't want to miss out on absolutely brilliant programming insight: 🤣 @luke_garrigan


Latest comments (66)
Before this book one should read the Pragmatic Programmer book, that is referenced several times in the Clean Code book, that now have a new edition to commemorate the 20th Anniversary from the first release.
I like the book overall, but don't follow it blindly.
Thank you for wrapping this up. I absolutely agree that every developer should read this book. The book gives really good advice on how to code and also what to express with code. In my personal opinion, Uncle Bob sometimes is a bit extremistic in making an argument though. He tends to explain a single aspect so sharply pointed, that it can be in the neighbourhood of "wrong" or contradicts his own arguments from other chapters. So when reading the book, each thing should be seen as a proposition how to work. Trying to understand what the author wants to express and how he came there is key to understanding the argument and bringing it to life under the own circumstances.
What I don't like is to see this book as the "Holy Bible of code", which indicates that every single letter has to be obeyed to. Not understanding the rationale but still adhering to the words as they were written can cause all different kinds of new classes of problem.
I created a book list for software developer techread.dev
Definitely Clean Code is one of the best book.
Great article 😁
Thank you!
Uncle Bob is one of the amazing software engineers alive today. Read as much of his work as possible. Some really good work.
TL;DR: read the book, take it with a grain of salt, and try to take some of what Bob said into your daily thoughts about how some things are done.
As much as a like this book and it's commentary, this requires every developer that's ever touched a keyboard to live, eat, and breathe this ideology for it to be consistent. That doesn't mean that some of his suggestions can't be used, it's just that if you wanted this to be the holy Grail, it would really need to be executed perfectly.
That being said, look at CPPCoreGuidlines. Good standards based around a community and Bjarne. There are others like it for other languages.
While this may be completely true, it is completely forgetting the archenemy of every programmer, "The Deadline". When you are fighting the clock, and you have a choice, "Make it pretty, or make it work." This is typically when style goes out the window.
Yeah, unfortunately, this happens far too often. Especially when the product is new and the business wants to see results fast. It's in the developers' hands though, if they think it's going to take longer to make the code clean, maintainable, extendable then it's their responsibility to let the appropriate people know!
Nope. It is full of ill, destructive advice and OOP zealotry. Programmers who took this broken book too seriously are lost, and I personally will never want to have to work with any of them.
Absolutely true, this book has changed a lot about how I think and write code (excuse me, I meant TESTS)
Some comments have been hidden by the post's author - find out more