CLEAN CODE
CLEAN CODE
“…clean code does one thing well…”- BjarneStroustrup, inventor of C++
“…clean code is full of crisp abstractions…”- Grady Booch, author of Object Oriented Analysis and Design with Applications
“…it has unit and acceptance tests…”- “Big” Dave Thomas, founder of OTI, creator of Eclipse
“…early building of simple abstractions…”- Ron Jeffries, author of Extreme Programming Installed
“…[clean code] makes the language look like it was made to solve the problem…”- Ward Cunningham, inventor of eXtreme Programming, Smalltalk thought leader
“…clean code always looks like it was written by someone who cares…”- Michael Feathers, author of Working Effectively with Legacy Code
Clean Code: Chapter 1

Clean Code: Chapter 1

  • 1.
  • 5.
  • 6.
    “…clean code doesone thing well…”- BjarneStroustrup, inventor of C++
  • 7.
    “…clean code isfull of crisp abstractions…”- Grady Booch, author of Object Oriented Analysis and Design with Applications
  • 8.
    “…it has unitand acceptance tests…”- “Big” Dave Thomas, founder of OTI, creator of Eclipse
  • 9.
    “…early building ofsimple abstractions…”- Ron Jeffries, author of Extreme Programming Installed
  • 10.
    “…[clean code] makesthe language look like it was made to solve the problem…”- Ward Cunningham, inventor of eXtreme Programming, Smalltalk thought leader
  • 11.
    “…clean code alwayslooks like it was written by someone who cares…”- Michael Feathers, author of Working Effectively with Legacy Code

Editor's Notes

  • #4 Consider a building with a few broken windows. If the windows are not repaired, the tendency is for vandals to break a few more windows. Eventually, they may even break into the building, and if it's unoccupied, perhaps become squatters or light fires inside.
  • #5 Programmers are like vandals.
  • #6 But what if, every time we committed some code, we left our project a little cleaner than when we found it.
  • #7 I like my code to be elegant and efficient. The logic should be straightforward to make it hard for bugs to hide, the dependencies minimal to ease maintenance, error handling complete according to an articulated strategy, and performance close to optimal so as not to temp people to make the code messy with unprincipled optimizations. Clean code does one thing well.
  • #8 Clean code is simple and direct. Clean code reads like well-written prose. Clean code never obscures the designer’s intent but rather is full of crisp abstractions and straightforward lines of control.
  • #9 Clean code can be read and enhanced by a developer other than its original author. It has unit and acceptance tests. It has meaningful names. It provides one way rather than many ways for doing one thing. It has minimal dependencies, which are explicitly defined, and provides a clear and minimal API. Code should be a literate since depding on the language, not all necessary information can be expressed clearly in code alone.
  • #10 In recent years I begin, and nearly end, with Kent Beck’s rules of simple code. In priority order, simple code:Runs all the testsContains no duplicationsExpresses all the design ideas that are in the systemMinimizes the number of entieies such as classes, methods, functions, and the likeReduce duplication, high expressiveness, and early building of simple abstractions. That’s what makes clean code for me.
  • #11 You know you are working on clean code when each routing you read turns out to be pretty much what you expected. You can call it beautiful code when the code also makes it look like the language was made for the problem.
  • #12 I could list all of the qualities that I notice in clean code, but there is one overarching quality that leads to all of them. Clean code always looks like it was written by someone who cares. There is nothing obvious that you can do to make it better. All of those things were thought about by the code’s author, and if you try to imagine improvements, you’re led back to where you are, sitting in appreciation of the code someone left for you – code left by someone who cares deeply about the craft.
  • #13 I could list all of the qualities that I notice in clean code, but there is one overarching quality that leads to all of them. Clean code always looks like it was written by someone who cares. There is nothing obvious that you can do to make it better. All of those things were thought about by the code’s author, and if you try to imagine improvements, you’re led back to where you are, sitting in appreciation of the code someone left for you – code left by someone who cares deeply about the craft.