Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
By:  Jan de Vries E-mail:  [email_address]
<ul><li>Title: Clean Code A Handbook of Agile Software  Craftmanship </li></ul><ul><li>Author: Robert C. Martin </li></ul>...
<ul><li>Awareness </li></ul><ul><li>Tips on how to produce better code </li></ul><ul><li>Readability </li></ul><ul><li>The...
<ul><li>Smart developer </li></ul><ul><ul><li>Difficult code </li></ul></ul><ul><ul><li>Has great developing skills </li><...
<ul><li>Seiri – Organize/Sort </li></ul><ul><li>Seiton – Systemize/Tidiness </li></ul><ul><li>Seiso – Cleaning </li></ul><...
<ul><li>Go fast? </li></ul><ul><li>Angry boss? </li></ul><ul><li>Tired of project? </li></ul><ul><li>Get working now, clea...
<ul><li>Redesign of system </li></ul><ul><li>Everybody wants in </li></ul><ul><li>Everything the old system does + better ...
<ul><li>Requirements change and not meet design </li></ul><ul><li>Schedules too tight </li></ul><ul><li>Stupid managers </...
<ul><li>It’s us, the developers! </li></ul>
<ul><li>They ask  us  for information </li></ul><ul><li>If they don’t, make  yourself  noticed </li></ul><ul><li>Users ask...
 
<ul><li>Take your time </li></ul><ul><li>Not  theList </li></ul><ul><li>Searchable names </li></ul><ul><ul><li>Constants <...
<ul><li>Mental mapping </li></ul><ul><ul><li>i, j, k,  l </li></ul></ul><ul><li>Pronouncable </li></ul><ul><li>1 word per ...
<ul><li>Small </li></ul><ul><ul><li>< 150 characters per line </li></ul></ul><ul><ul><li>< 20 lines </li></ul></ul><ul><li...
<ul><li>Extract try-catch </li></ul><ul><li>Error handling is 1 thing </li></ul><ul><li>Don’t repeat </li></ul><ul><li>Not...
<ul><li>Don’t </li></ul><ul><li>Self-explaining </li></ul><ul><li>If you can’t do any better </li></ul><ul><li>Clarificati...
<ul><li>Redundant </li></ul><ul><li>Misleading </li></ul><ul><li>Noise </li></ul><ul><li>Copy-pasting </li></ul><ul><li>Us...
<ul><li>Variable declarations </li></ul><ul><ul><li>Where they are used </li></ul></ul><ul><li>Instance variables </li></u...
<ul><li>Law of Demeter </li></ul><ul><ul><li>Method  f  of a class  C  should only call the methods of these: </li></ul></...
<ul><li>Narrow down exceptions </li></ul><ul><li>Provide context </li></ul><ul><li>Don’t return null; Don’t pass null </li...
<ul><li>Exploring & learing </li></ul><ul><ul><li>Experiment & learn </li></ul></ul><ul><ul><li>Reading manual </li></ul><...
<ul><li>Three laws of TDD </li></ul><ul><ul><li>You may not write production code until you have written a failing unit te...
<ul><li>Keeping tests clean </li></ul><ul><ul><li>Maybe more important as actual code </li></ul></ul><ul><li>No fear of re...
<ul><li>F.I.R.S.T. </li></ul><ul><ul><li>Fast </li></ul></ul><ul><ul><li>Independent </li></ul></ul><ul><ul><li>Repeatable...
<ul><li>Should be small </li></ul><ul><li>Single Responsibility Principle </li></ul><ul><ul><li>SQL    Select, Update </l...
<ul><li>Start small </li></ul><ul><li>Add features later </li></ul>
<ul><li>Keep synchronized blocks small </li></ul><ul><li>Don’t share objects </li></ul><ul><li>Suspicious failures  </li><...
<ul><li>Start with bad code and clean it </li></ul><ul><li>Keeping things small </li></ul><ul><li>Keeping code readably </...
 
Upcoming SlideShare
Loading in …5
×

Clean Code summary

20,931 views

Published on

Presentation I held before my colleagues about the book Clean Code (http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882).
It contains the highlights of several chapters and hint/guidelines a developer should know.

Published in: Technology

Clean Code summary

  1. 1. By: Jan de Vries E-mail: [email_address]
  2. 2. <ul><li>Title: Clean Code A Handbook of Agile Software Craftmanship </li></ul><ul><li>Author: Robert C. Martin </li></ul><ul><li>Pages: 349 </li></ul><ul><li>Chapters: 17 </li></ul><ul><li>Target Audience: Developers </li></ul><ul><li>Slides: 29 </li></ul>
  3. 3. <ul><li>Awareness </li></ul><ul><li>Tips on how to produce better code </li></ul><ul><li>Readability </li></ul><ul><li>The ‘boy scout rule’ </li></ul><ul><li>Starting out with tips and examples </li></ul><ul><li>Later on real world examples </li></ul><ul><li>It’s not the bible! </li></ul>
  4. 4. <ul><li>Smart developer </li></ul><ul><ul><li>Difficult code </li></ul></ul><ul><ul><li>Has great developing skills </li></ul></ul><ul><ul><li>r = lowercase url </li></ul></ul><ul><li>Professional developer </li></ul><ul><ul><li>Readable code </li></ul></ul><ul><ul><li>Maintanable code </li></ul></ul><ul><ul><li>‘ Clarity is king’ </li></ul></ul><ul><ul><li>lowercaseUrlOfCurrentPage = lowercase url </li></ul></ul>
  5. 5. <ul><li>Seiri – Organize/Sort </li></ul><ul><li>Seiton – Systemize/Tidiness </li></ul><ul><li>Seiso – Cleaning </li></ul><ul><li>Seiketsu – Standardization </li></ul><ul><li>Shutsuke - Discipline </li></ul>
  6. 6. <ul><li>Go fast? </li></ul><ul><li>Angry boss? </li></ul><ul><li>Tired of project? </li></ul><ul><li>Get working now, clean up later? </li></ul><ul><li>Everybody does it! </li></ul>
  7. 7. <ul><li>Redesign of system </li></ul><ul><li>Everybody wants in </li></ul><ul><li>Everything the old system does + better </li></ul><ul><li>Takes a long time </li></ul><ul><li>Team members leave </li></ul>
  8. 8. <ul><li>Requirements change and not meet design </li></ul><ul><li>Schedules too tight </li></ul><ul><li>Stupid managers </li></ul><ul><li>Intolerant customers </li></ul><ul><li>Useless sales </li></ul>
  9. 9. <ul><li>It’s us, the developers! </li></ul>
  10. 10. <ul><li>They ask us for information </li></ul><ul><li>If they don’t, make yourself noticed </li></ul><ul><li>Users ask us if requirements fit the system </li></ul><ul><li>Project managers ask us to help with schedule </li></ul>
  11. 12. <ul><li>Take your time </li></ul><ul><li>Not theList </li></ul><ul><li>Searchable names </li></ul><ul><ul><li>Constants </li></ul></ul><ul><li>Hungarian Notation </li></ul><ul><ul><li>IDE </li></ul></ul><ul><li>Member prefixes </li></ul><ul><li>Interfaces </li></ul>
  12. 13. <ul><li>Mental mapping </li></ul><ul><ul><li>i, j, k, l </li></ul></ul><ul><li>Pronouncable </li></ul><ul><li>1 word per concept </li></ul><ul><ul><li>Get, retrieve, fetch </li></ul></ul><ul><ul><li>Controller, manager, driver </li></ul></ul><ul><li>Use domain names </li></ul><ul><ul><li>Read by programmers </li></ul></ul>
  13. 14. <ul><li>Small </li></ul><ul><ul><li>< 150 characters per line </li></ul></ul><ul><ul><li>< 20 lines </li></ul></ul><ul><li>Blocks, indenting </li></ul><ul><li>1 thing! </li></ul><ul><li>Arguments </li></ul><ul><li>Side effects </li></ul><ul><li>Prefer exceptions </li></ul>
  14. 15. <ul><li>Extract try-catch </li></ul><ul><li>Error handling is 1 thing </li></ul><ul><li>Don’t repeat </li></ul><ul><li>Not all at once </li></ul>
  15. 16. <ul><li>Don’t </li></ul><ul><li>Self-explaining </li></ul><ul><li>If you can’t do any better </li></ul><ul><li>Clarification </li></ul><ul><li>Warning </li></ul><ul><li>TODO </li></ul>
  16. 17. <ul><li>Redundant </li></ul><ul><li>Misleading </li></ul><ul><li>Noise </li></ul><ul><li>Copy-pasting </li></ul><ul><li>Use a function or variable </li></ul><ul><li>Closing brace comments </li></ul><ul><li>Commented out code </li></ul><ul><li>Version control! </li></ul>
  17. 18. <ul><li>Variable declarations </li></ul><ul><ul><li>Where they are used </li></ul></ul><ul><li>Instance variables </li></ul><ul><ul><li>Top of class </li></ul></ul><ul><li>Dependancy </li></ul><ul><ul><li>Top-down </li></ul></ul><ul><li>Not 1-line functions </li></ul><ul><li>Team rules </li></ul><ul><ul><li>10 minutes </li></ul></ul><ul><ul><li>IDE formatter </li></ul></ul>
  18. 19. <ul><li>Law of Demeter </li></ul><ul><ul><li>Method f of a class C should only call the methods of these: </li></ul></ul><ul><ul><ul><li>C </li></ul></ul></ul><ul><ul><ul><li>An object created by f </li></ul></ul></ul><ul><ul><ul><li>An object passed as an argument to f </li></ul></ul></ul><ul><ul><ul><li>An object held in an instance variable of C </li></ul></ul></ul><ul><li>Objects </li></ul><ul><li>Data structures </li></ul>
  19. 20. <ul><li>Narrow down exceptions </li></ul><ul><li>Provide context </li></ul><ul><li>Don’t return null; Don’t pass null </li></ul><ul><ul><li>Prevents null-checking </li></ul></ul>
  20. 21. <ul><li>Exploring & learing </li></ul><ul><ul><li>Experiment & learn </li></ul></ul><ul><ul><li>Reading manual </li></ul></ul><ul><li>Using non-existing code </li></ul><ul><ul><li>Interface </li></ul></ul><ul><ul><li>Write your own </li></ul></ul>
  21. 22. <ul><li>Three laws of TDD </li></ul><ul><ul><li>You may not write production code until you have written a failing unit test </li></ul></ul><ul><ul><li>You may not write more of a unit test than is sufficient to fail, and not compiling is failing </li></ul></ul><ul><ul><li>You may not write more production code than is sufficient to pass the currently failing test </li></ul></ul>
  22. 23. <ul><li>Keeping tests clean </li></ul><ul><ul><li>Maybe more important as actual code </li></ul></ul><ul><li>No fear of refactoring </li></ul><ul><li>One assert per test </li></ul><ul><li>Single concept per test </li></ul>
  23. 24. <ul><li>F.I.R.S.T. </li></ul><ul><ul><li>Fast </li></ul></ul><ul><ul><li>Independent </li></ul></ul><ul><ul><li>Repeatable </li></ul></ul><ul><ul><li>Self-validating </li></ul></ul><ul><ul><li>Timely </li></ul></ul>
  24. 25. <ul><li>Should be small </li></ul><ul><li>Single Responsibility Principle </li></ul><ul><ul><li>SQL  Select, Update </li></ul></ul><ul><li>Easy to change code </li></ul>
  25. 26. <ul><li>Start small </li></ul><ul><li>Add features later </li></ul>
  26. 27. <ul><li>Keep synchronized blocks small </li></ul><ul><li>Don’t share objects </li></ul><ul><li>Suspicious failures </li></ul><ul><ul><li>Are bugs, not cosmic glitches </li></ul></ul>
  27. 28. <ul><li>Start with bad code and clean it </li></ul><ul><li>Keeping things small </li></ul><ul><li>Keeping code readably </li></ul><ul><li>Self-explaining </li></ul><ul><li>Standards </li></ul><ul><li>Unit testing </li></ul><ul><li>Interfaces, abstract classes, OO </li></ul><ul><li>You are responsible! </li></ul>

×