Clean Code
29%
off

Clean Code : A Handbook of Agile Software Craftsmanship

4.36 (8,039 ratings by Goodreads)
By (author) 

Free delivery worldwide

Available. Dispatched from the UK in 1 business day
When will my order arrive?

Description

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 understandingHow 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 developmentThis book is a must for any developer, software engineer, project manager, team lead, or systems analyst with an interest in producing better code.show more

Product details

  • Paperback | 464 pages
  • 177.8 x 233.68 x 25.4mm | 680.39g
  • Pearson Education (US)
  • Prentice Hall
  • Upper Saddle River, United States
  • English
  • 17th print.
  • w. ill. and listings
  • 0132350882
  • 9780132350884
  • 2,663

Back cover copy

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 codeHow to write good code and how to transform bad code into good codeHow to create good names, good functions, good objects, and good classesHow to format code for maximum readabilityHow to implement complete error handling without obscuring code logicHow to unit test and practice test-driven developmentThis book is a must for any developer, software engineer, project manager, team lead, or systems analyst with an interest in producing better code.show more

About Robert C. Martin

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.show more

Table of contents

Foreword xixIntroduction xxvOn the Cover xxixChapter 1: Clean Code 1There Will Be Code 2Bad Code 3The Total Cost of Owning a Mess 4Schools of Thought 12We Are Authors 13The Boy Scout Rule 14Prequel and Principles 15Conclusion 15Bibliography 15Chapter 2: Meaningful Names 17Introduction 17Use Intention-Revealing Names 18Avoid Disinformation 19Make Meaningful Distinctions 20Use Pronounceable Names 21Use Searchable Names 22Avoid Encodings 23Avoid Mental Mapping 25Class Names 25Method Names 25Don't Be Cute 26Pick One Word per Concept 26Don't Pun 26Use Solution Domain Names 27Use Problem Domain Names 27Add Meaningful Context 27Don't Add Gratuitous Context 29Final Words 30Chapter 3: Functions 31Small! 34Do One Thing 35One Level of Abstraction per Function 36Switch Statements 37Use Descriptive Names 39Function Arguments 40Have No Side Effects 44Command Query Separation 45Prefer Exceptions to Returning Error Codes 46Don't Repeat Yourself 48Structured Programming 48How Do You Write Functions Like This? 49Conclusion 49SetupTeardownIncluder 50Bibliography 52Chapter 4: Comments 53Comments Do Not Make Up for Bad Code 55Explain Yourself in Code 55Good Comments 55Bad Comments 59Bibliography 74Chapter 5: Formatting 75The Purpose of Formatting 76Vertical Formatting 76Horizontal Formatting 85Team Rules 90Uncle Bob's Formatting Rules 90Chapter 6: Objects and Data Structures 93Data Abstraction 93Data/Object Anti-Symmetry 95The Law of Demeter 97Data Transfer Objects 100Conclusion 101Bibliography 101Chapter 7: Error Handling 103Use Exceptions Rather Than Return Codes 104Write Your Try-Catch-Finally Statement First 105Use Unchecked Exceptions 106Provide Context with Exceptions 107Define Exception Classes in Terms of a Caller's Needs 107Define the Normal Flow 109Don't Return Null 110Don't Pass Null 111Conclusion 112Bibliography 112Chapter 8: Boundaries 113Using Third-Party Code 114Exploring and Learning Boundaries 116Learning log4j 116Learning Tests Are Better Than Free 118Using Code That Does Not Yet Exist 118Clean Boundaries 120Bibliography 120Chapter 9: Unit Tests 121The Three Laws of TDD 122Keeping Tests Clean 123Clean Tests 124One Assert per Test 130F.I.R.S.T. 132Conclusion 133Bibliography 133Chapter 10: Classes 135Class Organization 136Classes Should Be Small! 136Organizing for Change 147Bibliography 151Chapter 11: Systems 153How Would You Build a City? 154Separate Constructing a System from Using It 154Scaling Up 157Java Proxies 161Pure Java AOP Frameworks 163AspectJ Aspects 166Test Drive the System Architecture 166Optimize Decision Making 167Use Standards Wisely, When They Add Demonstrable Value 168Systems Need Domain-Specific Languages 168Conclusion 169Bibliography 169Chapter 12: Emergence 171Getting Clean via Emergent Design 171Simple Design Rule 1: Runs All the Tests 172Simple Design Rules 2-4: Refactoring 172No Duplication 173Expressive 175Minimal Classes and Methods 176Conclusion 176Bibliography 176Chapter 13: Concurrency 177Why Concurrency? 178Challenges 180Concurrency Defense Principles 180Know Your Library 182Know Your Execution Models 183Beware Dependencies Between Synchronized Methods 185Keep Synchronized Sections Small 185Writing Correct Shut-Down Code Is Hard 186Testing Threaded Code 186Conclusion 190Bibliography 191Chapter 14: Successive Refinement 193Args Implementation 194Args: The Rough Draft 201String Arguments 214Conclusion 250Chapter 15: JUnit Internals 251The JUnit Framework 252Conclusion 265Chapter 16: Refactoring SerialDate 267First, Make It Work 268Then Make It Right 270Conclusion 284Bibliography 284Chapter 17: Smells and Heuristics 285Comments 286Environment 287Functions 288General 288Java 307Names 309Tests 313Conclusion 314Bibliography 315Appendix A: Concurrency II 317Client/Server Example 317Possible Paths of Execution 321Knowing Your Library 326Dependencies Between Methods Can Break Concurrent Code 329Increasing Throughput 333Deadlock 335Testing Multithreaded Code 339Tool Support for Testing Thread-Based Code 342Conclusion 342Tutorial: Full Code Examples 343Appendix B: org.jfree.date.SerialDate 349Appendix C: Cross References of Heuristics 409Epilogue 411Index 413show more

Review Text

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 developmentThis book is a must for any developer, software engineer, project manager, team lead, or systems analyst with an interest in producing better code.show more

Rating details

8,039 ratings
4.36 out of 5 stars
5 52% (4,187)
4 35% (2,835)
3 10% (829)
2 2% (147)
1 1% (41)
Book ratings by Goodreads
Goodreads is the world's largest site for readers with over 50 million reviews. We're featuring millions of their reader ratings on our book pages to help you find your new favourite book. Close X