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

More Related Content

What's hot (20)

PPTX
Clean Code I - Best Practices
Theo Jungeblut
 
PPTX
Clean code slide
Anh Huan Miu
 
PPT
Coding Standards & Best Practices for iOS/C#
Asim Rais Siddiqui
 
PDF
Clean code
Achintya Kumar
 
PPTX
Clean code
Mahmoud Zizo
 
PPTX
Clean code
ifnu bima
 
PPTX
The Art of Clean code
Victor Rentea
 
PDF
Real Life Clean Architecture
Mattia Battiston
 
PPTX
Clean Code
Dmytro Turskyi
 
PDF
Clean code
Arturo Herrero
 
PDF
An Introduction to Test Driven Development
CodeOps Technologies LLP
 
PPTX
A Practical Guide to Domain Driven Design: Presentation Slides
thinkddd
 
PPTX
Clean Pragmatic Architecture - Avoiding a Monolith
Victor Rentea
 
PPTX
Clean Code
swaraj Patil
 
PDF
Clean code
Alvaro García Loaisa
 
PPT
TDD (Test Driven Design)
nedirtv
 
PDF
Clean Code
ISchwarz23
 
PPTX
The tests are trying to tell you [email protected]
Victor Rentea
 
PPTX
Code Review Best Practices
Trisha Gee
 
PDF
7 rules of simple and maintainable code
Geshan Manandhar
 
Clean Code I - Best Practices
Theo Jungeblut
 
Clean code slide
Anh Huan Miu
 
Coding Standards & Best Practices for iOS/C#
Asim Rais Siddiqui
 
Clean code
Achintya Kumar
 
Clean code
Mahmoud Zizo
 
Clean code
ifnu bima
 
The Art of Clean code
Victor Rentea
 
Real Life Clean Architecture
Mattia Battiston
 
Clean Code
Dmytro Turskyi
 
Clean code
Arturo Herrero
 
An Introduction to Test Driven Development
CodeOps Technologies LLP
 
A Practical Guide to Domain Driven Design: Presentation Slides
thinkddd
 
Clean Pragmatic Architecture - Avoiding a Monolith
Victor Rentea
 
Clean Code
swaraj Patil
 
TDD (Test Driven Design)
nedirtv
 
Clean Code
ISchwarz23
 
The tests are trying to tell you [email protected]
Victor Rentea
 
Code Review Best Practices
Trisha Gee
 
7 rules of simple and maintainable code
Geshan Manandhar
 

Similar to Clean Code summary (20)

PDF
Clean Code. An Agile Guide to Software Craft Kameron H.
komvjzfjj621
 
PDF
Clean Code. An Agile Guide to Software Craft Kameron H.
krantzloigu
 
PPTX
Clean code
Simon Sönnby
 
PDF
Clean Code. An Agile Guide to Software Craft Kameron H.
sagolbencib
 
PDF
Clean Code
Chris Farrell
 
PPTX
Writing Clean Code (Recommendations by Robert Martin)
Shirish Bari
 
PDF
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
DevDay Da Nang
 
PDF
Clean Code .Net Cheetsheets
NikitaGoncharuk1
 
PPTX
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
PDF
Clean code and code smells
Md. Aftab Uddin Kajal
 
PPT
Coding Standards
Jeevitesh Ms
 
PPTX
Clean code presentation
Bhavin Gandhi
 
PPTX
Clean Code - Writing code for human
NETKO Solution
 
PDF
Clean code-v2.2
Bình Trọng Án
 
PPTX
Clean Code (David Frame) - PHPBelfast Meetup 22/02/24
davidgrantframe
 
PPTX
Clean code quotes - Citações e provocações
André de Fontana Ignacio
 
PDF
Clean Code Principles And Patterns A Software Practitioners Handbook 1 No Cov...
politomuqeem
 
PDF
UNIT I cloud computing ppt cloud ccd all about the cloud computing
vishnubala78900
 
PPTX
Principled And Clean Coding
Metin Ogurlu
 
PDF
Clean Code V2
Jean Carlo Machado
 
Clean Code. An Agile Guide to Software Craft Kameron H.
komvjzfjj621
 
Clean Code. An Agile Guide to Software Craft Kameron H.
krantzloigu
 
Clean code
Simon Sönnby
 
Clean Code. An Agile Guide to Software Craft Kameron H.
sagolbencib
 
Clean Code
Chris Farrell
 
Writing Clean Code (Recommendations by Robert Martin)
Shirish Bari
 
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
DevDay Da Nang
 
Clean Code .Net Cheetsheets
NikitaGoncharuk1
 
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
Clean code and code smells
Md. Aftab Uddin Kajal
 
Coding Standards
Jeevitesh Ms
 
Clean code presentation
Bhavin Gandhi
 
Clean Code - Writing code for human
NETKO Solution
 
Clean code-v2.2
Bình Trọng Án
 
Clean Code (David Frame) - PHPBelfast Meetup 22/02/24
davidgrantframe
 
Clean code quotes - Citações e provocações
André de Fontana Ignacio
 
Clean Code Principles And Patterns A Software Practitioners Handbook 1 No Cov...
politomuqeem
 
UNIT I cloud computing ppt cloud ccd all about the cloud computing
vishnubala78900
 
Principled And Clean Coding
Metin Ogurlu
 
Clean Code V2
Jean Carlo Machado
 
Ad

More from Jan de Vries (17)

PDF
Webdev Zwolle - PaaSwordless in Azure
Jan de Vries
 
PDF
Global Azure - Use Azure Active Directory Managed Identities for your services!
Jan de Vries
 
PDF
Next.Net event - Use Azure Active Directory Managed Identities for your servi...
Jan de Vries
 
PPTX
Move Up - Design je Azure Functions als een pro
Jan de Vries
 
PDF
TechDays Sweden - Creating real-life serverless solutions with Azure Functions
Jan de Vries
 
PDF
TechDays Sweden - No Nouns!
Jan de Vries
 
PPTX
Serverless... Hoe, wat en vooral waarom
Jan de Vries
 
PPTX
Why care about serverless
Jan de Vries
 
PPTX
No nouns, hoe ga je een microservices architectuur opzetten
Jan de Vries
 
PDF
No nouns
Jan de Vries
 
PPTX
Creating real life serverless solutions with Azure Functions
Jan de Vries
 
PPTX
Creating real life serverless solutions with Azure Functions - dotNet Amsterd...
Jan de Vries
 
PPTX
Using the Azure Container Service in your company
Jan de Vries
 
PPTX
TechDays 2017 - Creating real life serverless solutions with azure functions
Jan de Vries
 
PPTX
Visual Studio 2017
Jan de Vries
 
PPTX
Applied patterns in the project
Jan de Vries
 
PPTX
Dependency injection en testen
Jan de Vries
 
Webdev Zwolle - PaaSwordless in Azure
Jan de Vries
 
Global Azure - Use Azure Active Directory Managed Identities for your services!
Jan de Vries
 
Next.Net event - Use Azure Active Directory Managed Identities for your servi...
Jan de Vries
 
Move Up - Design je Azure Functions als een pro
Jan de Vries
 
TechDays Sweden - Creating real-life serverless solutions with Azure Functions
Jan de Vries
 
TechDays Sweden - No Nouns!
Jan de Vries
 
Serverless... Hoe, wat en vooral waarom
Jan de Vries
 
Why care about serverless
Jan de Vries
 
No nouns, hoe ga je een microservices architectuur opzetten
Jan de Vries
 
No nouns
Jan de Vries
 
Creating real life serverless solutions with Azure Functions
Jan de Vries
 
Creating real life serverless solutions with Azure Functions - dotNet Amsterd...
Jan de Vries
 
Using the Azure Container Service in your company
Jan de Vries
 
TechDays 2017 - Creating real life serverless solutions with azure functions
Jan de Vries
 
Visual Studio 2017
Jan de Vries
 
Applied patterns in the project
Jan de Vries
 
Dependency injection en testen
Jan de Vries
 
Ad

Recently uploaded (20)

PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 

Clean Code summary

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

Editor's Notes

  • #3: Niet alle slides, komt wel op internet/share Auteur  zo’n 40 jaar ervaring
  • #4: Bewustmaking van het probleem Tips geven hoe te verbeteren Leesbare code maken Het is niet de bijbel noch staat het in steen geschreven. Eigen interpretatie is goed, maar sla de adviezen niet zomaar in de wind. 40 jaar ervaring is niet niks ‘ boy scout rule’  Laat je kampeerplaats schoner achter dan je hem bent tegen gekomen. Openen van een klasse, verbeter deze!
  • #5: Smart -&gt; Moeilijke code, iedereen echt zo van ‘Wow dat het kan’, show-offs om te laten zien dat ze zo goed zijn en snappen waar de moeilijke code voor dient. ‘ r’ is voor de lowercase url Professional -&gt; deze code goed leesbaar, goed te onderhouden
  • #6: Organiseer je code, sorteer alle functies en klassen Breng een systeem aan om dit te doen en maak het netter, bijvoorbeeld regions, public boven, getters setters bij elkaar, etc. Maak de code schoon, kleine aanpassingen zijn comments weg halen, betere variabele namen. Grote zijn om de code te herschrijven met interfaces, abstracte klassen, etc. Spreek een standaard af en gebruik deze in het hele team Discipline is nodig om alles te kunnen volgen.
  • #7: Komt door snel je code afleveren Deadlines Vervelend project, snel afmaken Maak het later wel beter Iedereen doet het
  • #8: Wordt 1 grote zooi Niemand wil er meer aan werken Schoon maken is een immens karwei Nieuw systeem zal komen waar iedereen aan wil werken Moet hetzelfde kunnen als het oude systeem Duurt lang Originele bezetting is weg, nieuwe members, uiteindelijk ontstaat er weer een draak, mits geen goede discipline
  • #9: De eisen/wensen kloppen niet met je systeem, moet veel worden omgeschreven Te strakke planning Stomme managers die er niets van snappen Klanten die niet weten wat ze willen of niet accepteren dat ze iets moeten doen Sales heeft iets raars verkocht
  • #10: Het komt eigenlijk door ons zelf
  • #13: Geen List of zo, want later wordt het misschien een Array en dat is iets heel anders “ de waarde” is lastig zoeken, lastiger als DE_WAARDE Hongaarse notatie is ouderwets, IDE moet het wel af kunnen Member variabelen geen prefixes, moet de IDE aan kunnen Dit heb ik nog niet kunnen bewerkstelligen Interfaces zonder I. Die zegt namelijk niets.
  • #14: Uitspreekbaar, zodat je het over de code kunt hebben Ontwikkelaars lezen en maken de code, je kunt dus best namen en dergelijke uit het vakgebied gebruiken
  • #15: Organiseren van je code 0 argumenten is beter als 1. 1 is beter als 2, 3 is een draak van een functie Return altijd iets, anders kun je niet testen Functie maar 1 doel Exceptions zijn beter dan error codes
  • #16: Try-catch in een zo’n klein mogelijke scope Eigen error handling klasse Niet alles in 1x proberen goed te doen, dat is ondoenlijk
  • #17: Gebruik geen commentaar, als dat nodig is, kun je de tijd beter besteden om een goede functie/naam te bedenken Alleen maar als je niet beter code kunt schrijven Code is self-explaning Warnings geven dat iets lang duurt, kan TODO’s of zo mag ook
  • #18: Commentaar kan oud worden en niet vernieuwd Misleidend Niemand leest het Bij een } commentaar is onnodig, omdat functies al klein zijn Commented out code  Versiebeheer
  • #19: Variabelen declareren waar ze nodig zijn Member variabelen boven in Niet alles op 1 regel proppen Snelle afspraken waar iedereen zich aan houdt en die uitbreiden waar nodig
  • #20: Objecten en data structures zijn niet hetzelfde. Gebruik ze dan ook anders
  • #21: Zo klein mogelijke exceptions, dus niet catch(Exception ex) Stacktraces mee geven, maar ook aangeven wat er fout is gegaan met welke waarde, etc. Niet null door geven, dat scheelt ook weer code
  • #22: Als je iets moet implementeren kun je beter proberen het te maken en testen schrijven ipv tientallen pagina’s documentatie doorlezen. Zo maak je dus ook al een begin met je testen Interfaces gebruiken voor nog niet bestaande code en zelf implementeren
  • #24: Test code is bijna belangrijker als normale code Als het niet leesbaar/bruikbaar is, is het vertrouwen ook weg
  • #25: Fastt, otherwise no one will test Independant, no dependency from each other Repeatable on any environment Self-validating, either true or false, no log file Timely, just before the actual code is written
  • #26: Select &amp; update in their own classes, they do somehting similar, but different nonetheless
  • #27: Snelweg concept van Yves