Slide 1

Slide 1 text

1 CLEAN CODE Four rules for simple design, according to Kent Beck

Slide 2

Slide 2 text

WHO IS KENT BECK? 2 +Agile Manifesto +JUnit

Slide 3

Slide 3 text

IS TDD DEAD? 3

Slide 4

Slide 4 text

THE PURSUIT OF SIMPLICITY 4 Do the simplest thing that could possibly work

Slide 5

Slide 5 text

5 RULE 1 - ALL TESTS MUST PASS ! Program correctness Feedback loops Confidence levels Ease of evolution Working specification ! !

Slide 6

Slide 6 text

THE PYRAMID OF TESTING 6 Unit tests Integration tests Functional tests The higher we go ! ▫︎fewer numbers ▫︎slower feedback ▫︎higher cost

Slide 7

Slide 7 text

7 ! ! Duplication is waste Eliminate waste Say it once, Say it well Less code means fewer bugs ! ! RULE 2 - ONCE AND ONLY ONCE (OOO)

Slide 8

Slide 8 text

RULE 3 - EXPRESS YOUR INTENT 8 ! All in the name Staying small Role playing Tell, don’t ask The world as we see it

Slide 9

Slide 9 text

9 ! ! ! Would you really need this? (minimal methods, classes, & modules) RULE 4 - NO SUPERFLUOUS PARTS

Slide 10

Slide 10 text

FORM VS. FUNCTION 10

Slide 11

Slide 11 text

ENDLESS POSSIBILITIES 11

Slide 12

Slide 12 text

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?

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

THE SIMPLE DESIGN DYNAMO TM 14

Slide 15

Slide 15 text

SUMMARY 15 ! ! 1. All tests must pass 2. Don’t repeat yourself 3. Express your intent 4. Stay lean

Slide 16

Slide 16 text

For questions or suggestions: ! Avinash Chugh [email protected] THANK YOU

Slide 17

Slide 17 text

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/