PullRequest Blog

3 Books on Clean Code Every Developer Should Read

Reading these books will make you a better programmer. You’ll understand the software development process more and reduce technical debt as you write and refactor code. These three essential books will help you learn about clean coding practices that might otherwise be learned in code review or lengthy refactorings.

Disclaimer: These books are old and wise

All of the books below were written 10 to 25 years ago. However, they have stood the test of time. Although not every suggestion is still applicable, you’ll find that nearly all of the concepts and guidelines still apply today.

The founders of Agile Software Development

Most of the authors below were part of the original “Manifesto for Agile Software Development.” The fundamentals from this are a cornerstone of modern software methodologies and processes. It’s no wonder that their books continue to be influential to software engineering practices today.

The three best books to learn how to write clean code

Clean Code: A Handbook of Agile Software Craftsmanship

By Robert C. Martin

“Clean code is not written by following a set of rules. You don’t become a software craftsman by learning a list of heuristics. Professionalism and craftsmanship come from values that drive disciplines.” — Clean Code: A Handbook of Agile Software Craftsmanship

Robert Martin, also known as Uncle Bob, first published this classic book in 2008. In addition to being one of the authors of the Agile Manifesto, he pioneered several modern principles of clean coding, such as the SOLID design principles.

One of his main points in this book is to have empathy while writing your code. Empathy for anyone who will end up reading your code, including your future self.

Cover from Clean Code: A Handbook of Agile Software Craftsmanship
Cover from Clean Code: A Handbook of Agile Software Craftsmanship

Clean Code is one of the most commonly seen books on a programmer’s desk because it’s more approachable, especially for new developers. Instead of high-level processes, Clean Code focuses on specific tactical principles, such as how to write classes and functions.

It’s filled with some highly opinionated suggestions such as “Never write functions with more than three arguments.” or “Never write functions longer than 15 lines.” Suggestions that, even if you disagree with them, at least get you thinking about best practices.

Glance through this summary of Clean Code for a quick list of the points made in the book.

Code Complete

By Steve McConnell

“Trying to improve software quality by increasing the amount of testing is like trying to lose weight by weighing yourself more often. What you eat before you step onto the scale determines how much you will weigh, and the software-development techniques you use determine how many errors testing will find.” — Code Complete

Originally written in 1993, (Code Complete), is still credited as the most practical guide to the programming process. Despite its age, most of the principles discussed are universal and still valid today.

If you’re a beginner, strongly consider reading Clean Code first. Code Complete focuses on higher level coding guidelines and the complete software development process. Much of the information will be difficult for a new engineer to understand or apply to their programming.

If you’re a technical lead looking to make the most out of your software process, this is a fundamental book for you. It’s so influential on modern coding practices that many senior technical managers have read the whole book more than once in their career.

Cover from Code Complete 2 by Steve McConnell
Cover from Code Complete 2 by Steve McConnell

Heads up, coming in at a whopping 914 pages long, it’s a behemoth of knowledge that will take time to get through. If you’re not ready to work through the whole thing it can be a valuable reference.

Wondering if the concepts might be worth the length? Check out these notes on the Code Complete book.

The Pragmatic Programmer: From Journeyman to Master

By Andrew Hunt and David Thomas

“You Can’t Write Perfect Software. Did that hurt? It shouldn’t. Accept it as an axiom of life. Embrace it. Celebrate it. Because perfect software doesn’t exist. No one in the brief history of computing has ever written a piece of perfect software. It’s unlikely that you’ll be the first. And unless you accept this as a fact, you’ll end up wasting time and energy chasing an impossible dream.” — The Pragmatic Programmer: From Journeyman to Master

Although it was written in 1999, The Pragmatic Programmer is a timeless read for any level of software engineer. Remarkably, it will still be as useful in 10 years as it is now.  While Clean Code covers coding principles and Code Complete focuses on the software process, The Pragmatic Programmer focuses on working within a software team.

The authors go in depth on a number of behavior practices. They write about programming almost philosophically rather than with specific technical examples. This sets up a reader to recognize common sense practices that should be used in all software development.

Many of these practices are fundamental to software teams today. So don’t be surprised if, as you’re reading, you see an overlap with much of today’s Agile Development methodologies and techniques. Because of this connection, more experienced developers may find the tips to be common sense. For them, the value in reading is likely more for reinforcing best practices rather than revelations about how to work on a software team.

Cover from The Pragmatic Programmer: From Journeyman to Master
Cover from The Pragmatic Programmer: From Journeyman to Master

Intermediate and advanced-beginner software developers will benefit the most from this book. The Pragmatic Programmer will provide them with a solid introduction on how to contribute maintainable code on a team. Even junior developers will find themselves recognizing and agreeing with some of the concepts. They should be common sense, but decades of code filled with unnecessary technical debt prove that many programmers don’t live by them. Some examples include, DRY (Don’t Repeat Yourself), “Don’t Panic When Debugging”, and “Don’t Gather Requirements – Dig for Them.”

Want to learn more before picking up a copy? Here’s a lengthy summary of The Pragmatic Programmer and a quick reference of all 70 tips.

A plea on behalf of the authors (and publishers)

Works like these would not be possible without developers like you making a purchase. While you might be able to find pirated books, please support the authors. Doing so allows authors and publishers to bring more ideas to the world.


About PullRequest

PullRequest is a platform for code review, built for teams of all sizes. We have the world's largest network of on-demand reviewers, backed by best-in-class automation tools. Because code quality is important. Learn more about PullRequest

Brennan Angel headshot
by Brennan Angel

October 1, 2018