Clean Code: A Handbook of Agile Software Craftsmanship Book Pdf ePub

Clean Code: A Handbook of Agile Software Craftsmanship

by
4.389,459 votes • 574 reviews
Published 11 Aug 2008
Clean Code: A Handbook of Agile Software Craftsmanship.pdf
Format Paperback
Pages434
Edition22
Publisher Prentice Hall
ISBN 0132350882
ISBN139780132350884
Languageeng



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.
"

"Clean Code: A Handbook of Agile Software Craftsmanship" Reviews

Oana
- Cluj-Napoca, 400020, Romania
0
Sun, 08 Mar 2015

These are rather notes than a review while reading:
1. Use very descriptive names. Be consistent with your names.
2. A function should not do more than one thing.
3. SRP (Single Responsibility Principle): a class or module should have one, and only one, reason to change.
4. Stepdown rule: every function should be followed by those at the next level of abstraction (low, intermediate, advanced).
5. A long descriptive name is better than a short enigmatic name. A long descriptive name is better than a long descriptive comment.
6. The ideal number of arguments for a function is zero (niladic). Next comes one (monadic), followed closely by two (dyadic). Three arguments (triadic) should be avoided where possible. More than three (polyadic) requires very special justification and then shouldn't be used anyway.
7. Flag arguments are ugly. Passing a boolean into a function is loudly proclaiming that this function does more than one thing. It does one thing if the flag is true and another one if the flag is false.
8. Write learning test when using third-party cody to make sure it behaves the way you expect it to. And if codebase changes in time, at least you find out early enough.

Francis
- Birkenhead, CH42, The United Kingdom
3
Thu, 26 Aug 2010

The first half of this book is well worth a read. Then I was reminded of Martin Fowler's (I think) comment that the original Design Patterns Elements of Reusable Software book was a response to the limitations of C++. It dovetailed so well into Java because Java has a lot of the same annoying limitations, and in some ways is even harder.
The latter section of the book contains some worked examples that I didn't always agree with because they seemed to be totally over done. A lot of the refactorings came from limitations in the language and even then felt arbitrary and not that "clean", more like differences of opinion.
In light of this I think the book would have been better titled Clean Java, and then we'd all know where we stand. Have to say I was disappointed by the case studies. I think if you're a jobbing Java programmer you will get a real benefit from this book. I use dynamic languages like Ruby and most of the problems described in need of refactoring just never happen.

Vladimir
- Z├╝rich, Switzerland
4
Thu, 14 Apr 2011

This book makes some very good points, sometimes taking them to extreme ("Never write functions longer than 15 lines! Never write functions with more than three arguments!"). Some of these points were quite new and useful for me - YMMV. It's too Java-specific in a few places, and reading the last refactoring chapter on a kindle was quite a challenge, but otherwise it was well worth a read. At least I got a clear picture of how I want to refactor a big piece of my current project after reading this :)

Jerry
- Chicago, IL
3
Fri, 09 Jan 2009

I had a tough time deciding between 3 or 4 stars.
The book should be called Clean Java Code. Some of the concepts definitely translate to other languages, but it uses Java for all of the examples and some of the chapters are dedicated to Java-specific issues.
I consider many of the the suggestions to simply be common sense, but I've worked with enough of "other people's code" to realize they don't necessarily agree. With all of that said, I'd definitely recommend the book to Java developers at the beginner and intermediate levels.

Nariman
- Langrood, Guilan, Iran
5
Tue, 05 Apr 2016

If you are a programmer, you must read it! full of good examples of how to write clean and readable code.

Rod
4
Sat, 04 Oct 2008

There is a movement brewing in the world of professional software development. This movement is concerned not merely with writing functional, correct code, but also on writing good code. Taking pride in code. This movement is the Software Craftsmanship movement, and one of the people near the head of this movement is Robert C. Martin, also known as Uncle Bob.
His book "Clean Code" is, in many ways, an introduction to the concept of Software Craftsmanship and a guide for developers interested in becoming craftsmen. Clean Code is not about only writing correct code, it's about writing code that is designed well, code that reads well, and code that expresses the intent of the author.
The book is essentially divided into two parts. The first part contains Bob's suggestions for writing and maintaining clean code. This includes suggestions on everything ranging from how to properly comment code and how to properly name variables to how to separate your classes and how to construct testable concurrent code. The second part of the book uses the principles in the first part to guide the reader through a few exercises in which existing code is cleaned.
The first part of the book is fantastic. I can't recommend it highly enough for a professional software developer that wishes to elevate him or herself to a higher standard. This guide is excellent, and gave me lots of things to think about while reading it. I could almost feel myself becoming a better programmer as I internalized Martin's advice, and the code I've been writing has been noticeably better since I began following his suggestions.
In the second part of the book, Martin essentially guides us through three projects: a command line argument parser he wrote, a section of the JUnit source code, and a section of source code from SerialDate. Of these, the most detailed guide is Martin's illustration of refactoring the command line argument parser.
These sections all suffered from a fundamental flaw: they were inside a book.
These sections all required reading large amounts of source code. Not just scanning it, but really reading and understanding the code, so that the reader can understand the changes Martin makes to the code. Reading and understanding code is something I do every day as a professional, but I never have to do it from paper.
When I read code, I'm interacting with something, not just reading. I can scroll up and down. If I see a method being used and I wonder how it's written, I can click on it and jump right to the implementation. My IDE shows me symbols in my gutterbar when methods are overridden. I can press a keystroke to pull up a list of just the methods in a source file. I can right click on a method and find its usages immediately. The source code I am reading is something I can push and pull, gaining an understanding of it through interaction.
When source code is printed in a book, you get none of this. To make matters worse, Martin's code samples have absolutely no syntax highlighting applied to them. When I read source code, certain parts are rendered in specific ways that make it easier to pull the information into my brain. Strings and literals are formatted differently, comments are dimmer so I can focus on code, and so on. Code samples in "Clean Code" are just characters, with occasionally bolding used to draw attention to parts that were changed. It's amazing how much syntax highlighting helps make code more comprehensible, even at a completely subconscious level.
A book is, quite simply, not an appropriate medium for a guided code walkthrough. I'd have preferred the content of these sections as perhaps a lecture, with Martin's text done in audio and his code kept on the screen. This would at least prevent me from having to flip back and forth constantly. I didn't get as much out of these sections as I would have liked to, simply because it was so difficult to digest the information it contained in such an awkward, unnatural medium. At the very least, the code samples should have been printed in color, with syntax highlighting.
I can tell that his advice was good and that the refactorings he applied to the code samples in the book made the code far better, but mostly because I've observed these efforts in real life and observed how much they improve code. If I were to encounter Martin's "before" and "after" code in a project I was working on, I undoubtedly would find the "after" code far, far cleaner and more enjoyable to work with. However, since the book format made it so difficult to understand EITHER code sample, it didn't seem like Martin's efforts offered much improvement, even though I know they did.
Despite this frustration, the book is an excellent read, and I'm quite certain it has contributed a great deal to helping me improve as a professional. I can't recommend it enough, especially for Java developers. I just think that most readers will find the final few chapters intensely frustrating - I recommend downloading the code and viewing it in your favorite code editor so that you can comprehend the source code the way you would any other source code.

Smiliar Books of "Clean Code: A Handbook of Agile Software Craftsmanship"