The book every software developer must read

Many software developers want to be the best they can be in their craft, but few know how to achieve it. In the age of information overload, it is very hard to figure this out.

Although there are plenty of websites out there that tell you how to become a great developer, they often contradict each other. After all, anyone can post their opinion online, regardless of whether they know what they are talking about, or not.

Many programmers out there think that they know all the best practices, but they don’t. And they are not necessarily lying. Inexperienced programmers often share the practices that worked best for them without being aware that there are better ways of writing code.

But what if I told you that there is a book that tells you all you need to know about writing a great code – a code that is well-structured, easily readable and easily maintainable? Robert C. Martin has written such a book and it’s called Clean Code: A Handbook of Agile Software Craftsmanship.

But before we’ll get to know what the book is all about, let’s see why would you even want to be the best developer you can be.

Why would you want to be a great developer

Let’s forget for the moment all the talk about wanting to be a great developer in order to be a better contributor towards the business that employs you. And let’s forget about developing your skills in order to be selected for a promotion one day. Of course, these are good reasons. But, just like with everything else, there are good reasons, and there are real reasons.

Let’s be honest with ourselves and try to think about the most selfish reasons for wanting to be the best you can be at your craft. After all, selfishness can be healthy and ethical, as long as you aren’t deliberately making lives of other people harder. So, let’s forget your team and your boss for the moment.

If you are programming professionally, you will be spending a large chunk of your working day behind a computer. And because it is your life, you don’t want to waste it by being miserable. And the best way to not be miserable at work is to treat your job as a craft.

If you will start consciously thinking about writing your code in the best way possible, you will get absorbed in the process. It will become interesting. It may feel like playing a strategy game. You may even enter the state of flow. And the time will start flying.

And, if you derive a genuine pleasure from your work, the other things are sure to come as the side effect. You will provide a great contribution to both your team and your employer and your effectiveness will not go unnoticed by your superiors.

What Clean Code is all about

Clean Code covers the most fundamental best practices of writing a great code. Here are some subjects that are covered by the book:

  • Naming functions and classes
  • How each function and class needs to be structured
  • How to decide what needs to be in a single function and what needs to be spread out between several function
  • How to decide whether you can fit a particular piece of logic in a single class or spread it out between several classes
  • Why you shouldn’t repeat yourself

And there are many other subjects similar to these ones in scope.

Because the book talks about the best practices that are applied to writing the most fundamental code components, it is well suitable for beginners. In fact, beginners are the ones who will benefit from the book the most. It is much more effective to learn the best coding practices right from the start rather than learn how to write code badly and then spend some time unlearning your bad habits.

To facilitate this, the book is written in a very clean language and keeps technical jargon to the absolute minimum. The book is thick, as there is quite a lot of material it covers. However, each chapter is small and very easily digestible.

And there is nothing in the book that would be too complex for a novice programmer, such as software architecture and design patterns. For that, Robert C. Martin has written another book: Clean Architecture: A Craftsman’s Guide to Software Structure and Design.

Minor criticism

There is not much I can say about this book in terms of criticism. There are just a couple of minor points.

All of the examples are written in Java, which may not be an issue in itself, as almost any software developer familiar with object oriented programming would be able to understand the examples. After all, it is impossible to write a book on coding without providing any code examples. Likewise, it is impossible to cover all popular programming languages in a single book. However, there are couple of places in the book where advice would be just applicable to Java and would not necessarily translate to other programming languages.

For example, in the chapter about classes, the author insists that you should not have public class variables. And this is indeed how you would do it in Java. You would have a private class variable and, by convention, to retrieve its value, you would you have a “get” method, while to assign a new value to it, you would have a “set” method.

In C#, on the other hand, you would actually have an equivalent of public class variables known as properties. And it’s the property itself that will have “getter” and “setter” assigned directly to it. Although one may argue that a property in C# is not really a single public class variable, but rather a set of two methods – “get” and “set”, the code that uses the property uses it exactly in the same way as it would use a public class-level variable. So, these subtle differences between the languages need to be known.

Another Java-specific advice is on the naming conventions. In Java, you would use camel-case for any variable names, while in C#, you would only use camel-case for local and private variables. For public variables, you would use Pascal-case.

Luckily, these Java-specific pieces of advice in the book are quite rare. In fact, these are the only two instances I can remember. Therefore, it doesn’t devalue the book in any way. And, if you actually are a Java developer, then there is nothing for you to worry about at all.

Where to get this book

I am far from being the only programmer who would recommend Clean Code book. It is very well known in the software development industry and there are many developers who swear by it.

Therefore, just like any other popular book, it is always available on Amazon. And this is where you can get it:

Clean Code: A Handbook of Agile Software Craftsmanship (Robert C. Martin)