clean code: four rules of simple design

clean code: four rules of simple design

the slide deck used for an internal design/programming workshop for developers.

E2143258b0228b454fa4b63d406243f3?s=128

Avinash Chugh

May 31, 2014
Tweet

Transcript

  1. 1 CLEAN CODE Four rules for simple design, according to

    Kent Beck
  2. WHO IS KENT BECK? 2 +Agile Manifesto +JUnit

  3. IS TDD DEAD? 3

  4. THE PURSUIT OF SIMPLICITY 4 Do the simplest thing that

    could possibly work
  5. 5 RULE 1 - ALL TESTS MUST PASS ! Program

    correctness Feedback loops Confidence levels Ease of evolution Working specification ! !
  6. THE PYRAMID OF TESTING 6 Unit tests Integration tests Functional

    tests The higher we go ! ▫︎fewer numbers ▫︎slower feedback ▫︎higher cost
  7. 7 ! ! Duplication is waste Eliminate waste Say it

    once, Say it well Less code means fewer bugs ! ! RULE 2 - ONCE AND ONLY ONCE (OOO)
  8. RULE 3 - EXPRESS YOUR INTENT 8 ! All in

    the name Staying small Role playing Tell, don’t ask The world as we see it
  9. 9 ! ! ! Would you really need this? (minimal

    methods, classes, & modules) RULE 4 - NO SUPERFLUOUS PARTS
  10. FORM VS. FUNCTION 10

  11. ENDLESS POSSIBILITIES 11

  12. 12 YOU AIN’T GONNA NEED IT! ! ! The world

    is changing. fast. Build for what you know. Over time, you’ll know more. What if I could look ahead?
  13. LISTEN TO THE CODE 13 ! ! 1. Write a

    test, make it pass, refactor 2. Refactor to the point of simplicity 3. Listen to the code
  14. THE SIMPLE DESIGN DYNAMO TM 14

  15. SUMMARY 15 ! ! 1. All tests must pass 2.

    Don’t repeat yourself 3. Express your intent 4. Stay lean
  16. For questions or suggestions: ! Avinash Chugh avinashc@thoughtworks.com THANK YOU

  17. REFERENCES 17 ! ! 1. http://c2.com/cgi/wiki?XpSimplicityRules 2. http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/ 0132350882 3.

    http://math.ucr.edu/home/baez/physics/General/occam.html 4. http://blog.thecodewhisperer.com/2013/12/07/putting-an-age-old-battle-to-rest/