Advanced Search
Start Your Free Trial

Overview

Other Readers Also Read...

This is the Safari online edition of the printed book.

Even bad code can function. But if code isn’t clean, it can bring a development organization to its knees. Every year, countless hours and significant resources are lost because of poorly written code. But it doesn’t have to be that way.

Noted software expert Robert C. Martin presents a revolutionary paradigm with Clean Code: A Handbook of Agile Software Craftsmanship. Martin has teamed up with his colleagues from Object Mentor to distill their best agile practice of cleaning code “on the fly” into a book that will instill within you the values of a software craftsman and make you a better programmer—but only if you work at it.

What kind of work will you be doing? You’ll be reading code—lots of code. And you will be challenged to think about what’s right about that code, and what’s wrong with it. More importantly, you will be challenged to reassess your professional values and your commitment to your craft.

Clean Code is divided into three parts. The first describes the principles, patterns, and practices of writing clean code. The second part consists of several case studies of increasing complexity. Each case study is an exercise in cleaning up code—of transforming a code base that has some problems into one that is sound and efficient. The third part is the payoff: a single chapter containing a list of heuristics and “smells” gathered while creating the case studies. The result is a knowledge base that describes the way we think when we write, read, and clean code.

Readers will come away from this book understanding

  • How to tell the difference between good and bad code

  • How to write good code and how to transform bad code into good code

  • How to create good names, good functions, good objects, and good classes

  • How to format code for maximum readability

  • How to implement complete error handling without obscuring code logic

  • How to unit test and practice test-driven development

This book is a must for any developer, software engineer, project manager, team lead, or systems analyst with an interest in producing better code.

Amazon.com® Reader Reviews (Ranked by Helpfulness)

Average Amazon.com® Rating: 4.5 out of 5 rating Based on 45 Ratings

A Good Read - 2009-07-23
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
This book is split into three parts. The first describes the principles, patterns, and practices of writing clean code. The second part consists of several case studies of increasing complexity. Each case study is an exercise in cleaning up code--of transforming a code base that has some problems into one that is sound and efficient. The third part is a single chapter containing a list of heuristics and "smells" gathered while creating the case studies.

The book begins by describing what clean code actually is. This is achieved through discussing quotes provided by people such as Bjarne Stroustrup, Grady Booch, Dave Thomas, Michael Feathers, Ron Jeffries, Ward Cunningham, and Kent Beck. The basic premise is that code must be simple to read (by people other than the author), easy to test, have good test coverage, etc. This is pretty obvious -and therefore I'm sure you have an innate sense of what clean code is. This book helps to reinforce this, and tells you how to get there.

After discussing the basics of what clean code actually is, "Uncle" Bob moves on to working through the refactoring of a few different open source projects. He begins with bad code, and steps through a number of refactorings until the code is clearly much cleaner (albeit also much longer). These chapters are very easy to skip through, so you have to be sure to stick through it and really make sure you understand the reasoning behind each step.

I'd like to quote a paragraph out of the introduction in the book which summarises precisely the importance of really thinking whilst reading this chapter. The quote goes as follows:

"If you read the first and third sections and skip over the case studies, then you will have read yet another "feel good" book about writing good software. But if you take the time to work through the case studies, following every tiny step, every minute decision - if you put yourself in our place, and force yourself to think along the same paths that we thought, then you will gain a much richer understanding of those principles, patterns, practices, and heuristic. They won't be "feel good" knowledge any more. They'll have been ground into your gut, fingers, and heart. They'll have become part of you in the same way as a bicycle becomes an extension of your will when you have mastered how to ride it."

I really like this book; it was very easy to read, yet challenging and rewarding. I feel like I can read it again in a years time and learn plenty more. I really don't feel that I can offer any means in which this book can be improved. The only criticism I can level at the book is that it requires you to really invest time and effort into getting the most out of it.

To summarise this book as succinctly as I can, this book felt like the missing chapters from `Effective Java'. After reading both books, I feel I know everything I need to know about writing top-quality Java code. In addition, I know that when I ever have a question regarding writing quality Java code that by referring to these two books I will almost certainly have an answer awaiting me. Whereas Effective Java is about teaching you the Java language and how to use it, Clean Code is focused on ensuring code is easily readable and `clean'. It does this by describing how to format and refactor bad code, and whilst a lot of what this book says is obvious (use good names, keep functions short, ensure your tests pass, etc), it's still a good read, as there are certainly ideas in this book that you may have forgotten otherwise.

Good stuff -- *UN*common sense. - 2009-10-07
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
Another reviewer stated that most of this book was "common sense". However, he either didn't read the whole book (usually the case) or he works only with people who have. The focus of the book is pouding the concept into your head first THAT you need clean code and then HOW you write clean code. It's starts as easy, light read but it slowly changes into a compelling case study ... usable by any developer in any OO language. While I agreed with many of the concepts in the book before I read it, it still seemed that it was good for other people, not necessarily me. NOW, I'm a true believer and you probably will be too!

Recommended to any developer ... highly recommended for any developer that doesn't work alone. The only real downside is that the book's sample code is almost exclusively Java. However, most OO coders can read other languages even if they can't write in them.

Solid Principles and Advice for Any OO Developer - 2009-09-11
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
This book provides some really good principles that all developers can benefit from using. If you have been developing software for any length of time, then some of the principles and techniques laid down in this book will not be very shocking. But even if that is the case it is still a good refresher course. After awhile if we are exposed to really bad code sometimes if wears off on us and this book can help you to shake off some of those bad habits you may have picked up. For myself, I found that this book really hits the nail on the head when it talks about the importance of readability and good OOD. As a developer that has maintained many legacy applications, I can appreciate the clear understanding these authors have of writing code that is not only functional but is maintainable. I also like how the authors walk you through the exercise of cleaning bad legacy code. It really helps you learn the principles that are discussed in the first part of the book. I also found the code snippets in the book to be very helpful and did not find many mistakes. In general I would recommend this book to both new OO developers and even experienced OO developers just looking for some fresh insight into our craft.

Great rules to follow - 2009-10-15
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
It definitely teaches me how to write a better and clean code. Following these rules would save a lot of maintaining time and efforts. Good code comes from the beginning.
Thank the authors.

Excellent - 2009-07-28
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
This book definitely changed my outlook on writing code. It does an excellent job at explaining and clearly demonstrating the importance of clean code - separation of abstraction levels, recognition and removal of common smells and constant reevaluation and improvement of system in question.

Highly recommended.

Browse Similar Topics

Top Level Categories:
Software Engineering

Sub-Categories:
Software Engineering > Process
Software Engineering > Quality

Some information on this page was provided using data from Amazon.com®. View at Amazon >


About Safari Books Online • Terms of Service • Privacy Policy • Contact Us • Corporate Licenses • Help • Accessibility | See us on FacebookSee us on Linked InSee us on TwitterRSS

Copyright 2009 Safari Books Online. All rights reserved.