Clean Code: A Handbook of Agile Software Craftsmanship and over one million other books are available for Amazon Kindle. Learn more


or
Sign in to turn on 1-Click ordering.
or
Amazon Prime Free Trial required. Sign up when you check out. Learn More
Kindle Edition
 
   
Sell Back Your Copy
For a $15.75 Gift Card
Trade in
More Buying Choices
Have one to sell? Sell yours here
Clean Code: A Handbook of Agile Software Craftsmanship
 
 
Start reading Clean Code: A Handbook of Agile Software Craftsmanship on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Clean Code: A Handbook of Agile Software Craftsmanship [Paperback]

Robert C. Martin (Author)
4.3 out of 5 stars  See all reviews (110 customer reviews)

List Price: $49.99
Price: $33.60 & this item ships for FREE with Super Saver Shipping. Details
You Save: $16.39 (33%)
  Special Offers Available
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
In Stock.
Ships from and sold by Amazon.com. Gift-wrap available.
Want it delivered Thursday, May 31? Choose One-Day Shipping at checkout. Details
Textbook Student FREE Two-Day Shipping for students on millions of items. Learn more

Formats

Amazon Price New from Used from
Kindle Edition $15.22  
Paperback $33.60  
Unknown Binding --  
Sell Back Your Copy for $15.75
Whether you bought it on Amazon or somewhere else, you can sell it back through our Book Trade-In Program at the current price of $15.75.
Used Price$31.27
Trade-in Price$15.75
Price after
Trade-in
$15.52

Book Description

August 11, 2008 0132350882 978-0132350884 1
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.


Special Offers and Product Promotions

  • Buy $50 in qualifying physical textbooks, get $2 in Amazon MP3 Credit. Here's how (restrictions apply)

Frequently Bought Together

Clean Code: A Handbook of Agile Software Craftsmanship + Code Complete: A Practical Handbook of Software Construction, Second Edition + The Pragmatic Programmer: From Journeyman to Master
Price For All Three: $98.06

Show availability and shipping details

Buy the selected items together
  • In Stock.
    Ships from and sold by Amazon.com.
    This item ships for FREE with Super Saver Shipping. Details

  • Code Complete: A Practical Handbook of Software Construction, Second Edition $29.54

    In Stock.
    Ships from and sold by Amazon.com.
    This item ships for FREE with Super Saver Shipping. Details

  • The Pragmatic Programmer: From Journeyman to Master $34.92

    In Stock.
    Ships from and sold by Amazon.com.
    This item ships for FREE with Super Saver Shipping. Details



Editorial Reviews

About the Author

Robert C. “Uncle Bob” Martin has been a software professional since 1970 and an international software consultant since 1990. He is founder and president of Object Mentor, Inc., a team of experienced consultants who mentor their clients worldwide in the fields of C++, Java, C#, Ruby, OO, Design Patterns, UML, Agile Methodologies, and eXtreme programming.

Excerpt. © Reprinted by permission. All rights reserved.

Which door represents your code? Which door represents your team or your company? Why are we in that room? Is this just a normal code review or have we found a stream of horrible problems shortly after going live? Are we debugging in a panic, poring over code that we thought worked? Are customers leaving in droves and managers breathing down our necks? How can we make sure we wind up behind the right door when the going gets tough? The answer is: craftsmanship.

There are two parts to learning craftsmanship: knowledge and work. You must gain the knowledge of principles, patterns, practices, and heuristics that a craftsman knows, and you must also grind that knowledge into your fingers, eyes, and gut by working hard and practicing.

I can teach you the physics of riding a bicycle. Indeed, the classical mathematics is relatively straightforward. Gravity, friction, angular momentum, center of mass, and so forth, can be demonstrated with less than a page full of equations. Given those formulae I could prove to you that bicycle riding is practical and give you all the knowledge you needed to make it work. And you'd still fall down the first time you climbed on that bike.

Coding is no different. We could write down all the "feel good" principles of clean code and then trust you to do the work (in other words, let you fall down when you get on the bike), but then what kind of teachers would that make us, and what kind of student would that make you?

No. That's not the way this book is going to work.

Learning to write clean code is hard work. It requires more than just the knowledge of principles and patterns. You must sweat over it. You must practice it yourself, and watch yourself fail. You must watch others practice it and fail. You must see them stumble and retrace their steps. You must see them agonize over decisions and see the price they pay for making those decisions the wrong way.

Be prepared to work hard while reading this book. This is not a "feel good" book that you can read on an airplane and finish before you land. This book will make you work, and work hard. 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. You'll be asked to follow along as we take modules apart and put them back together again. This will take time and effort; but we think it will be worth it.

We have divided this book into three parts. The first several chapters describe the principles, patterns, and practices of writing clean code. There is quite a bit of code in these chapters, and they will be challenging to read. They'll prepare you for the second section to come. If you put the book down after reading the first section, good luck to you!

The second part of the book is the harder work. It consists of several case studies of ever-increasing complexity. Each case study is an exercise in cleaning up some code--of transforming code that has some problems into code that has fewer problems. The detail in this section is intense. You will have to flip back and forth between the narrative and the code listings. You will have to analyze and understand the code we are working with and walk through our reasoning for making each change we make. Set aside some time because this should take you days.

The third part of this book is the payoff. It is a single chapter containing a list of heuristics and smells gathered while creating the case studies. As we walked through and cleaned up the code in the case studies, we documented every reason for our actions as a heuristic or smell. We tried to understand our own reactions to the code we were reading and changing, and worked hard to capture why we felt what we felt and did what we did. The result is a knowledge base that desribes the way we think when we write, read, and clean code.

This knowledge base is of limited value if you don't do the work of carefully reading through the case studies in the second part of this book. In those case studies we have carefully annotated each change we made with forward references to the heuristics. These forward references appear in square brackets like this: H22. This lets you see the context in which those heuristics were applied and written! It is not the heuristics themselves that are so valuable, it is the relationship between those heuristics and the discrete decisions we made while cleaning up the code in the case studies.

To further help you with those relationships, we have placed a cross-reference at the end of the book that shows the page number for every forward reference. You can use it to look up each place where a certain heuristic was applied.

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 heuristics. 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 that a bicycle becomes an extension of your will when you have mastered how to ride it.


Product Details

  • Paperback: 464 pages
  • Publisher: Prentice Hall; 1 edition (August 11, 2008)
  • Language: English
  • ISBN-10: 0132350882
  • ISBN-13: 978-0132350884
  • Product Dimensions: 9.2 x 7.3 x 0.9 inches
  • Shipping Weight: 1.5 pounds (View shipping rates and policies)
  • Average Customer Review: 4.3 out of 5 stars  See all reviews (110 customer reviews)
  • Amazon Best Sellers Rank: #7,197 in Books (See Top 100 in Books)

More About the Authors

Discover books, learn about writers, read author blogs, and more.

Customer Reviews

Most Helpful Customer Reviews
404 of 443 people found the following review helpful
Format:Kindle Edition
[Kindle Version Review]

The one star is not a reflection of the content of the book, which is clearly a very fine treatise on coding practices, but of the fact that the Kindle version is almost impossible to read. Code samples are truncated, in a variable-width font, and have less-than and greater-than symbols missing. References in the text often refer to listings that are not closely located with that text (eg. "see Listing 4-7 on page 71" is almost impossible to find on a Kindle without single-paging).

This is a book that requires a lot of page flipping, and shouldn't be available on the Kindle unless the publisher is willing to put in some effort to address these readability issues.
Was this review helpful to you?
71 of 74 people found the following review helpful
Applying the Boy Scout Rule... September 23, 2008
Format:Paperback|Amazon Verified Purchase
When you do code maintenance, you can really "love" or "hate" a person that you do not even know just by the code he or she has written. Messy code almost always goes hand in hand with lower productivity, lower motivation, and a higher number of bugs. In the first chapter, Robert C. Martin presents in a very instructive way, the opinion from very well-known personalities about what "clean code" is, and also suggests we apply the Boy Scout Rule (Leave the campground cleaner that you found it) to our code. The following chapters present practical advice about how to do this cleaning (or even better, how to avoid the mess in the first place).

The suggestions presented in the book (meaningful names, pertinence of comments, code formatting, etc) may sound very familiar to any experienced programmer but they are presented with such a level of detail and with very illustrative examples that it is almost impossible not to learn valuable things chapter by chapter. All the examples are in Java, but the guidelines they illustrate can be applied, in most of the cases, to other languages.

The most challenging chapter to read (but also a very valuable one) was the Refactoring of the class SerialDate (from the JCommon library). It is a real-life example and the author shows step-by-step what it takes to do refactoring. The last chapter, "Smells and Heuristics" makes a very good closure presenting in categories and in a condensed way, potential problems and suggested ways to solve/mitigate them.

I enjoyed reading this book and after finishing it, I decided to apply the Boy Scout Rule. I took a module written in a procedural language and not only managed to improve the clarity of the code, but also reduced the number of lines from more than 1,100 to 650. The next person to touch this code will certainly be happy to deal with cleaner code!
Was this review helpful to you?
55 of 57 people found the following review helpful
Format:Paperback
When most people hear the term "bad writing" they understand the term: Confusing, inconsistent, rambling, big words used incorrectly.

In fact, we have lots and lots of educational programs designed to teach grammar, composition, journalism, and fiction. Master's Degrees in the subject, even.

But for software development we seemed obsessed with "architecture" (whatever that means), process and patterns.

In this book, Bob Martin takes a specific stab at what good code looks like. He provides rules, examples, and even sample transformations.

It is not an easy book. If you are a new developer, you can invest a lot of time and energy into really absorbing the concepts and practicing them yourself. If you are more senior, you may disagree, you may struggle, you may toss the book in a corner and yell at it ...

But then you'll pick it back up again. And you will be a better developer for it.

One thing that I struggle with about the traditional CS cirricula is that so little attention is spent on maintenance, which is the vast majority of actual development time. This book presents an aesthetic and the skills to write maintainable code. If you teach software development, you'll want to use this book in your courses.

Student, Journeyman, Master, or Instructor - A book like this belongs on your bookshelf. Follow the advice in it, or have an explanation why not - either way you'll be a strong developer.

Of course, there are other books in this area. What struck me about this one is the quality of the writing; it is truly engaging and -- a little inspiring. That quality is so rare in technical books that I give this one five stars.
Comment | 
Was this review helpful to you?
Most Recent Customer Reviews
An Excellent Book
This was a very well written book. The principles and ideas in this book have had a very positive impact on my code and on the other guys on the team. We all read the book. Read more
Published 12 days ago by Trevor
Changed my way of coding
Before reading this book I used to develop ad-hoc, repeated code several times across several modules. Read more
Published 1 month ago by Rafael
From a newbie's point of view
Hello everyone,

first a short introduction: Although I have been programming for many years, I never did any professional work. Read more
Published 2 months ago by Ingo Bürk
So close, but no cigar
There are authors that suit you and there are authors that don't. Having spent a decent amount of time to get through Clean Code: A Handbook of Agile Software Craftsmanship, I have... Read more
Published 2 months ago by Vladimir Kocjancic
Excellent.
I dare go so far as to say anyone who considers themselves a software developer with any pride in their work should give this a read. Read more
Published 2 months ago by David Joseph Morgan
Better for less experienced programmers
I wanted to love this book, but instead I just sort of liked it. This book is a member of the extensive genre of books on how to write clean code. Read more
Published 2 months ago by E. RiceScherpelz
Clean Code
It's a good book for experienced developers too. I can suggest it for everyone who want to be a better software engineer!
Published 3 months ago by tamastom
The way the craft ought to be...
For the past few years I began to doubt whether my understanding of the craft was even correct anymore. Read more
Published 4 months ago by Broadmeadow
Wise words, poor illustrations.
Begins with some excellent insights on coding, emphasizing separation of concerns, supported by excellent examples (but, sadly some shamefully poor illustrations!). Read more
Published 5 months ago by D Hellinger
Should be updated to the new formats
It's a great book. Every programmer should read it. It's a pity references are not of hyper-linked. And it's specially a pity in chapters 16 and 17 where you have at least 10... Read more
Published 5 months ago by iapazmino
Search Customer Reviews
Only search this product's reviews

Inside This Book (learn more)
First Sentence:
You are reading this book for two reasons. Read the first page
Key Phrases - Statistically Improbable Phrases (SIPs): (learn more)
agile software development, vertical formatting, implementation patterns, literate programming, test driven development, public abstract void set, boolean isln, month enum, char arg, int candidate, boolean parse, public void set, clean code, concurrent code, sql class, festering pile, threaded code, bad code, dependency injection, missing double, double parameter, invalid format, checked exceptions, int year, int right
Key Phrases - Capitalized Phrases (CAPs): (learn more)
String Arguments, Successive Refinement Listing, Kent Beck, Design Patterns, Prentice Hall, The Rough Draft, Elements of Reusable Object Oriented Software, Law of Demeter, Classes Should Be Small, Martin Fowler, The Total Cost of Owning, Bad Comments, Single Responsibility Principle, Comments Listing, Pure Java, Internals Listing, Dave Thomas, Classes Listing, Args Implementation, Meaningful Names, Open Closed Principle, Clean Tests, Systems Listing, The Pragmatic Programmer, Feature Envy
Browse Sample Pages:
Front Cover | Table of Contents | First Pages | Index | Back Cover | Surprise Me!
Search Inside This Book:

What Other Items Do Customers Buy After Viewing This Item?


Tags Customers Associate with This Product

 (What's this?)
Click on a tag to find related items, discussions, and people.
 
(25)

Your tags: Add your first tag
 

Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
Topic:
First post:
Prompts for sign-in
 


Active discussions in related forums
Discussion Replies Latest Post
Is it OK if I used it to nudge several people towards Death Valley with it? 2683 1 hour ago
Shipping/Delivery 1 13 hours ago
I just received a "very good" textbook without its disc - what are your thoughts? 209 16 hours ago
Book trade in cancelled 0 17 hours ago
why prices for used books of the same edition differ at amazon? 1 19 hours ago
If I used your packing slip to sell books back and the time period expired for Amazon to receive, do I just lose my books somewhere? 2 20 hours ago
Your review to the textbook trade-in service 26 20 hours ago
Is this a scam? Where are my books? 206 21 hours ago
Search Customer Discussions
Search all Amazon discussions
   
Related forums





Look for Similar Items by Category


Look for Similar Items by Subject