SlideShare a Scribd company logo
Clean Code
5
A Handbook of Agile Software Craftsmanship
Robert C. Martin
Note by waegaein@github.com
Clean Code
The Total Cost of Owning a Mess
• Over the span of a year or two, teams that were moving very
fast at the beginning of a project can find themselves
moving at a snail’s pace.
The Total Cost of Owning a Mess
• Over the span of a year or two, teams that were moving very
fast at the beginning of a project can find themselves moving
at a snail’s pace.
• Every change they make to the code breaks two or three
other parts of the code.
The Total Cost of Owning a Mess
• Over the span of a year or two, teams that were moving very
fast at the beginning of a project can find themselves moving
at a snail’s pace.
• Every change they make to the code breaks two or three
other parts of the code.
• No change is trivial.
The Total Cost of Owning a Mess
• Over the span of a year or two, teams that were moving very
fast at the beginning of a project can find themselves moving
at a snail’s pace.
• Every change they make to the code breaks two or three
other parts of the code.
• No change is trivial.
• Every addition or modification to the system requires that the
tangles, twists, and knots be “understood” so that more
tangles, twists, and knots can be added.
The Total Cost of Owning a Mess
• As the mess build, the productivity of the team continues to
decrease.
The Total Cost of Owning a Mess
• As the mess build, the productivity of the team continues to
decrease.
• As productivity decreases, management does the only thing
they can; they add more staff to the project in hopes of
increasing productivity.
The Total Cost of Owning a Mess
• As the mess build, the productivity of the team continues to
decrease.
• As productivity decreases, management does the only thing
they can; they add more staff to the project in hopes of
increasing productivity.
• But that new staff is not versed in the design of the system.
The Total Cost of Owning a Mess
• Furthermore, they, and everyone else on the team, are under
horrific pressure to increase productivity.
The Total Cost of Owning a Mess
• Furthermore, they, and everyone else on the team, are under
horrific pressure to increase productivity.
• So they all make more and more messes, driving the
productivity ever further toward zero.
The Total Cost of Owning a Mess
Attitude
• Have you ever waded through a mess so grave that it took
weeks to do what should have taken hours?
Attitude
• Have you ever waded through a mess so grave that it took
weeks to do what should have taken hours?
• Have you seen what should have been a one-line change,
made instead in hundreds of different modules?
Attitude
• Have you ever waded through a mess so grave that it took
weeks to do what should have taken hours?
• Have you seen what should have been a one-line change,
made instead in hundreds of different modules?
• These symptoms are all too common.
Attitude
• Why does this happen to code?
Attitude
• Why does this happen to code?
• Why does good code rot so quickly into bad code?
Attitude
• We have lots of explanations for it.
Attitude
• We have lots of explanations for it.
• We complain that the requirements changed in ways that
thwart the original design.
Attitude
• We have lots of explanations for it.
• We complain that the requirements changed in ways that
thwart the original design.
• We bemoan the schedules that were too tight to do things
right.
Attitude
• We have lots of explanations for it.
• We complain that the requirements changed in ways that
thwart the original design.
• We bemoan the schedules that were too tight to do things
right.
• We blather about stupid managers and intolerant
customers and useless marketing types and telephone
sanitizers.
Attitude
• But the fault is not in our stars, but in ourselves.
Attitude
• But the fault is not in our stars, but in ourselves.
• We are unprofessional.
Attitude
“But wait!”
“If I don’t do what my manager says, I’ll be fired!”
Attitude
“But wait!”
“If I don’t do what my manager says, I’ll be fired!”
• Probably not.
Attitude
“But wait!”
“If I don’t do what my manager says, I’ll be fired!”
• Probably not.
• Most managers want the truth.
• Even when they don’t act like it.
Attitude
“But wait!”
“If I don’t do what my manager says, I’ll be fired!”
• Probably not.
• Most managers want the truth.
• Even when they don’t act like it.
• They may defend the schedule and requirements with
passion; but that’s their job.
Attitude
“But wait!”
“If I don’t do what my manager says, I’ll be fired!”
• Probably not.
• Most managers want the truth.
• Even when they don’t act like it.
• They may defend the schedule and requirements with
passion; but that’s their job.
• It’s your job to defend the code with equal passion.
Attitude
• A patient is complaining about doctor’s washing hands taking
too long.
Attitude
• A patient is complaining about doctor’s washing hands taking
too long.
• It would be unprofessional (never mind criminal) for the
doctor to comply with the patient and give up washing hands.
Attitude
• A patient is complaining about doctor’s washing hands taking
too long.
• It would be unprofessional (never mind criminal) for the
doctor to comply with the patient and give up washing hands.
• So too it is unprofessional for programmers to bend to the
will of managers who don’t understand the risks of making
messes.
The Boy Scout Rule
Leave the campground cleaner than you found it.

More Related Content

PPTX
The New Agile
PPTX
Testing economics101
PDF
Passion For Software
PPTX
TDD for the rest of us...
PPTX
Spaceship TDD Style
PPTX
Weekly updates 5
PPTX
How will I Survive a DevOps Transformation?
PDF
Atlassian: The latest and greatest - May/June 2013
The New Agile
Testing economics101
Passion For Software
TDD for the rest of us...
Spaceship TDD Style
Weekly updates 5
How will I Survive a DevOps Transformation?
Atlassian: The latest and greatest - May/June 2013

What's hot (18)

KEY
Agile Anti-patterns
PPTX
TDD patterns
PDF
15 Explosive Things You Should Try As An Agilist by Peter Gfader
PPT
Coaching Anti-Pattens and common smells
PDF
Overcome the 6 Antipatterns of Agile Adoption
PDF
How effective feedback can improve your software
PDF
Fail Safe, Fail Smart, Succeed
PPTX
To Estimate or #NoEstimate
PPTX
Making disaster routine
PDF
How to make good teams great
PDF
DevOps Picc12 Management Talk
PPTX
APIdays Paris 2019 - The (really) long journey to an API Community of Practic...
PPTX
Real Life Test Maintenance
PPTX
TDD for the rest of us
PPTX
Creating A Unit Testing Strategy
PDF
Root Cause Analysis: Fact and Fiction
PPTX
Welcome To Itteco
PDF
Confluence - From Wiki to Collaboration Platform
Agile Anti-patterns
TDD patterns
15 Explosive Things You Should Try As An Agilist by Peter Gfader
Coaching Anti-Pattens and common smells
Overcome the 6 Antipatterns of Agile Adoption
How effective feedback can improve your software
Fail Safe, Fail Smart, Succeed
To Estimate or #NoEstimate
Making disaster routine
How to make good teams great
DevOps Picc12 Management Talk
APIdays Paris 2019 - The (really) long journey to an API Community of Practic...
Real Life Test Maintenance
TDD for the rest of us
Creating A Unit Testing Strategy
Root Cause Analysis: Fact and Fiction
Welcome To Itteco
Confluence - From Wiki to Collaboration Platform
Ad

Similar to Clean Code - 5 (20)

KEY
The business case for contributing code
PDF
DevOps Year One
PPT
Money, Process, and Culture- Tech 20/20 June, 2012
PPTX
Emperors new clothes_jab
PDF
Software Developer Career Unplugged - GeeCon 2013
PDF
Velocity Conference NYC 2014 - Real World DevOps
PDF
ChefConf 2015 - Chef Retrospective
PPTX
[DSC Adria 23] Radovan Bacovic Steal Our Knowledge Please.pptx
KEY
Cloud Security: Ten Things
PDF
Being agile while standing in a waterfall
KEY
Social dev camp_2011
PDF
SRE for Everyone: Making Tomorrow Better Than Today
PPTX
How I Learned to Stop Worrying and Love Legacy Code.....
PDF
Devops, The future is here, it's just not evenly distributed
PDF
SRE Lessons for the Enterprise
PDF
Let's bring the teams back together
PDF
Agile: the Good, the Bad and the Ugly - Webinar by Clarke Ching Agile - Septe...
KEY
Less 'Oh Shit' With GIT
KEY
Tweakers Anonymous
KEY
Community and Github: 7/27/2011
The business case for contributing code
DevOps Year One
Money, Process, and Culture- Tech 20/20 June, 2012
Emperors new clothes_jab
Software Developer Career Unplugged - GeeCon 2013
Velocity Conference NYC 2014 - Real World DevOps
ChefConf 2015 - Chef Retrospective
[DSC Adria 23] Radovan Bacovic Steal Our Knowledge Please.pptx
Cloud Security: Ten Things
Being agile while standing in a waterfall
Social dev camp_2011
SRE for Everyone: Making Tomorrow Better Than Today
How I Learned to Stop Worrying and Love Legacy Code.....
Devops, The future is here, it's just not evenly distributed
SRE Lessons for the Enterprise
Let's bring the teams back together
Agile: the Good, the Bad and the Ugly - Webinar by Clarke Ching Agile - Septe...
Less 'Oh Shit' With GIT
Tweakers Anonymous
Community and Github: 7/27/2011
Ad

More from Don Kim (11)

PDF
Clean Code - 4
PDF
Clean Code - 3
PDF
Clean Code - 2
PDF
Clean Code - 1
PDF
Design and Analyze Secure Networked Systems - 7
PDF
Design and Analyze Secure Networked Systems - 6
PDF
Design and Analyze Secure Networked Systems - 5
PDF
Design and Analyze Secure Networked Systems - 4
PDF
Design and Analyze Secure Networked Systems - 3
PDF
Design and Analyze Secure Networked Systems - 2
PPTX
Design and Analyze Secure Networked Systems - 1
Clean Code - 4
Clean Code - 3
Clean Code - 2
Clean Code - 1
Design and Analyze Secure Networked Systems - 7
Design and Analyze Secure Networked Systems - 6
Design and Analyze Secure Networked Systems - 5
Design and Analyze Secure Networked Systems - 4
Design and Analyze Secure Networked Systems - 3
Design and Analyze Secure Networked Systems - 2
Design and Analyze Secure Networked Systems - 1

Recently uploaded (20)

PDF
Nekopoi APK 2025 free lastest update
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Introduction to Artificial Intelligence
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPT
Introduction Database Management System for Course Database
PDF
medical staffing services at VALiNTRY
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
System and Network Administration Chapter 2
Nekopoi APK 2025 free lastest update
Odoo POS Development Services by CandidRoot Solutions
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Introduction to Artificial Intelligence
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
CHAPTER 2 - PM Management and IT Context
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Upgrade and Innovation Strategies for SAP ERP Customers
Which alternative to Crystal Reports is best for small or large businesses.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Odoo Companies in India – Driving Business Transformation.pdf
ManageIQ - Sprint 268 Review - Slide Deck
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Introduction Database Management System for Course Database
medical staffing services at VALiNTRY
How to Choose the Right IT Partner for Your Business in Malaysia
Understanding Forklifts - TECH EHS Solution
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
System and Network Administration Chapter 2

Clean Code - 5

  • 1. Clean Code 5 A Handbook of Agile Software Craftsmanship Robert C. Martin Note by waegaein@github.com
  • 3. The Total Cost of Owning a Mess • Over the span of a year or two, teams that were moving very fast at the beginning of a project can find themselves moving at a snail’s pace.
  • 4. The Total Cost of Owning a Mess • Over the span of a year or two, teams that were moving very fast at the beginning of a project can find themselves moving at a snail’s pace. • Every change they make to the code breaks two or three other parts of the code.
  • 5. The Total Cost of Owning a Mess • Over the span of a year or two, teams that were moving very fast at the beginning of a project can find themselves moving at a snail’s pace. • Every change they make to the code breaks two or three other parts of the code. • No change is trivial.
  • 6. The Total Cost of Owning a Mess • Over the span of a year or two, teams that were moving very fast at the beginning of a project can find themselves moving at a snail’s pace. • Every change they make to the code breaks two or three other parts of the code. • No change is trivial. • Every addition or modification to the system requires that the tangles, twists, and knots be “understood” so that more tangles, twists, and knots can be added.
  • 7. The Total Cost of Owning a Mess • As the mess build, the productivity of the team continues to decrease.
  • 8. The Total Cost of Owning a Mess • As the mess build, the productivity of the team continues to decrease. • As productivity decreases, management does the only thing they can; they add more staff to the project in hopes of increasing productivity.
  • 9. The Total Cost of Owning a Mess • As the mess build, the productivity of the team continues to decrease. • As productivity decreases, management does the only thing they can; they add more staff to the project in hopes of increasing productivity. • But that new staff is not versed in the design of the system.
  • 10. The Total Cost of Owning a Mess • Furthermore, they, and everyone else on the team, are under horrific pressure to increase productivity.
  • 11. The Total Cost of Owning a Mess • Furthermore, they, and everyone else on the team, are under horrific pressure to increase productivity. • So they all make more and more messes, driving the productivity ever further toward zero.
  • 12. The Total Cost of Owning a Mess
  • 13. Attitude • Have you ever waded through a mess so grave that it took weeks to do what should have taken hours?
  • 14. Attitude • Have you ever waded through a mess so grave that it took weeks to do what should have taken hours? • Have you seen what should have been a one-line change, made instead in hundreds of different modules?
  • 15. Attitude • Have you ever waded through a mess so grave that it took weeks to do what should have taken hours? • Have you seen what should have been a one-line change, made instead in hundreds of different modules? • These symptoms are all too common.
  • 16. Attitude • Why does this happen to code?
  • 17. Attitude • Why does this happen to code? • Why does good code rot so quickly into bad code?
  • 18. Attitude • We have lots of explanations for it.
  • 19. Attitude • We have lots of explanations for it. • We complain that the requirements changed in ways that thwart the original design.
  • 20. Attitude • We have lots of explanations for it. • We complain that the requirements changed in ways that thwart the original design. • We bemoan the schedules that were too tight to do things right.
  • 21. Attitude • We have lots of explanations for it. • We complain that the requirements changed in ways that thwart the original design. • We bemoan the schedules that were too tight to do things right. • We blather about stupid managers and intolerant customers and useless marketing types and telephone sanitizers.
  • 22. Attitude • But the fault is not in our stars, but in ourselves.
  • 23. Attitude • But the fault is not in our stars, but in ourselves. • We are unprofessional.
  • 24. Attitude “But wait!” “If I don’t do what my manager says, I’ll be fired!”
  • 25. Attitude “But wait!” “If I don’t do what my manager says, I’ll be fired!” • Probably not.
  • 26. Attitude “But wait!” “If I don’t do what my manager says, I’ll be fired!” • Probably not. • Most managers want the truth. • Even when they don’t act like it.
  • 27. Attitude “But wait!” “If I don’t do what my manager says, I’ll be fired!” • Probably not. • Most managers want the truth. • Even when they don’t act like it. • They may defend the schedule and requirements with passion; but that’s their job.
  • 28. Attitude “But wait!” “If I don’t do what my manager says, I’ll be fired!” • Probably not. • Most managers want the truth. • Even when they don’t act like it. • They may defend the schedule and requirements with passion; but that’s their job. • It’s your job to defend the code with equal passion.
  • 29. Attitude • A patient is complaining about doctor’s washing hands taking too long.
  • 30. Attitude • A patient is complaining about doctor’s washing hands taking too long. • It would be unprofessional (never mind criminal) for the doctor to comply with the patient and give up washing hands.
  • 31. Attitude • A patient is complaining about doctor’s washing hands taking too long. • It would be unprofessional (never mind criminal) for the doctor to comply with the patient and give up washing hands. • So too it is unprofessional for programmers to bend to the will of managers who don’t understand the risks of making messes.
  • 32. The Boy Scout Rule Leave the campground cleaner than you found it.