Java by Comparison - Become a Java Craftsman in 70 Examples
Why I read this book
Probably the most important skill all developers should master is the ability to write Clean Code, it also the hardest skill to master. The reason being, that often developers are caught between a rock and hard place in that we are often expected to just make things work by breaking problems down into simple solutions and work within tight and mostly undefinable deadlines.
Developer productivity is often measured by how many features or tickets have been implemented. In a lot of instances, many organizations don’t actually care about the quality of code being implemented, largely because quality is defined by the number of users are actually using the application or how quickly users can get new releases.
If I had a dollar for every time I’ve heard the phrase “Let’s get this out quickly and tidy it up later” I would not have to apply my trade of developing new software applications.
The other issue is that most developers can be quite egotistical about their code and firmly believe that because their code works and solves a problem then that counts as Good Clean Code.
They are also the same developers, who may have to return back to that code in a month or year or two to solve a small bug a user reports or even to extend the code to cater for a new use case. They find themselves not remembering or have difficulty understanding what exactly the code does or even why it’s doing it in the way it has been implemented.
What I learned from this book
Learning features, strategies, limitations, and concepts from other programming languages and frameworks often help you to gain a better understanding and appreciation of your programming language and framework of choice.
Learning a little more about Java and the Java API made me take a deeper look at the .Net Framework in general. The truth is C# and Java have a lot more in common than they have differences.
Regular readers of my blog and book reviews will know that I am not averse to reading books on other programming languages, as I have previously read and reviewed Philosophy of Software Design and Clean Code which are both Java Oriented in their approach.
I would re-iterate that it undoubtedly help you to grow as a developer in general by taking and understanding approaches from other programming languages.
What I liked about this book
One of my favourite chapters, is chapter 3 – Use Comments Wisely , mostly because for most of my careers I’ve had a love/hate relationship with comments, and have mostly trained myself over the years to actually ignore them. In some instances, I have configured my IDE to use the same colour as the background-colour for any comments.
This mostly due to most software developers don’t have the ability to actually comment code with anything useful to anybody other than themselves and even that is even possible.
The book outlines the most common cardinal sins of commenting and I still see and find these sins committed in most of the code bases I get to work on. All developers should take time to read chapter 3 – irrespective of programming language – because you’ll find that most of the solutions and advice contained is easily transferable to any language.
Taking the time to learn how to comment correctly will actually help wonders to improve your coding ability. Chapter 3 Builds on and adds some additional examples to advice contained within Clean Code by Robert C Martin and also highlights adds to some of the points discussed in Chapter 16 of the A Philosophy of Software Engineering
I found Chapter 7 – Design Your Objects well worth a read too, probably worth buying this book on its own. That and Chapter 8 – Let Your Data Flow, should be essential reading for all developers.
What I liked most about this book, is the format and the writing. This is referring to the printed copy – I mostly only read Technical Books in their printed form.
The page layout is a great format, that I personally not seen in technical books before. The left-hand side page is generally the problem code with commentary as why it’s bad and the right-hand page is the refactored code with commentary on what was fixed and why it helps improve the code.
The book has a companion website Java by Comparison which provides some additional information, resources and access to the E-Book which is well worth checking out.
What I did not like about this book
Strangely the only thing I don’t like about the book, is the title, although I do appreciate that this was most probably based on how to authors originally conceived the book, and also a nod to the layout concept. However, I feel the principles laid out in this book apply to all C based programming languages or even Object Oriented Programming languages.
Although Java is the primary programming language discussed in the book, the principles outlined do not only apply to Java. Maybe this Book should actually have been called Clean Code By Comparison.
Who Should Read this book?
In my personal opinion, all developers should take the time to read this book, regardless of level. New developers, should take note that this book will not teach you how to code, but rather it helps you to learn how to code properly. So at least a basic understanding of coding is needed.
Also, you should read this book, irrespective that it appears to mainly targeted at Java Developers, for reasons I have previously highlighted.
Why I recommend this book