99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdf
Agile and Beyond :: The Technical Debt Trap
1. The Technical Debt Trap
Michael J Norton
@DocOnDev
LeanDog LLC*
*The views expressed are not necessarily the views of LeanDog LLC
(but they could be)
5. What is Technical Debt?
Ward Cunningham
Shipping first time code is
like going into debt.
oopsla’92
6. What is Technical Debt?
Ward Cunningham
Shipping first time code is
like going into debt.
A little debt speeds
development so long
as it is paid back
promptly with a
rewrite.
oopsla’92
7. What is Technical Debt?
Ward Cunningham
The danger occurs
when the debt is not
repaid.
Every minute spent on not-
quite-right code counts as
interest on that debt.
oopsla’92
8. What is Technical Debt?
Ward Cunningham
The danger occurs
when the debt is not
repaid.
Every minute spent on not-
quite-right code counts as
interest on that debt.
oopsla’92
14. Metaphors Rock
We reason by analogy
Can’t keep running
at this pace
Building on a weak foundation
Puts pressure on
It’s raining men our design
15. Metaphors Rock
We reason by analogy
Can’t keep running
at this pace
Building on a weak foundation
Puts pressure on
It’s raining men our design
(hallelujah)
17. Metaphorphosis
When Metaphors go wrong
Return on Investment
Short-Term Fraudulent Credit Card
Inadvertent RecklessScheme
Pyramid Debt
Auto Loan
High Interest in the Third Quadrant
Home Loan Voluntary
Intentional Loan Shark Long-Term
Prudent Student Loan
Pragmatic Leverage Operational
19. Metaphorphosis
When Metaphors go wrong
“cut a lot of corners”
James Shore
http://jamesshore.com/Blog/CardMeeting/Voluntary-Technical-Debt.html
“quick and dirty”
Martin Fowler
“sloppy”
http://www.martinfowler.com/bliki/TechnicalDebt.html
David Laribee “just hack it in”
http://msdn.microsoft.com/en-us/magazine/ee819135.aspx
Steve McConnell
http://blogs.construx.com/blogs/stevemcc/archive/2007/11/01/technical-debt-2.aspx
21. That’s not what I said
Ward Cunningham
[Many] have explained the debt metaphor
and confused it with the idea that
you could write code poorly with
the intention of doing a good job later.
http://www.youtube.com/watch?v=pqeJFYwnkjE&feature=player_embedded youtube.com 2009
22. That’s not what I said
Ward Cunningham
[Many] have explained the debt metaphor
and confused it with the idea that
you could write code poorly with
the intention of doing a good job later.
http://www.youtube.com/watch?v=pqeJFYwnkjE&feature=player_embedded youtube.com 2009
23. That’s not what I said
Ward Cunningham
... confused it with
the idea that you
could write code
poorly ... youtube.com 2009
24. Clean Code is Required
Ward Cunningham
The ability to pay back debt [...]
depends upon you writing code that
is clean enough to be able to refactor
as you come to understand your
problem. youtube.com 2009
25. Clean Code is Required
Ward Cunningham
The ability to pay back debt [...]
depends upon you writing code that
is clean enough to be able to
refactor as you come to
understand your problem. youtube.com 2009
26. Dirty Code is a Bad Idea
Ward Cunningham
Dirty code is to technical debt as the
pawn broker is to financial debt.
Don't think you are ever going to get
your code back.
http://twitter.com/WardCunningham/status/3742903303 twitter 2009
27. Is it Technical Debt?
Ask yourself...
Is the code clean?
Is the code tested?
Is there a learning objective?
Is there a plan for payback?
Is the business truly informed?
28. Is it Technical Debt?
If you said no to even one
Is the code clean?
Is the code tested?
Is there a learning objective?
Is there a plan for payback?
Is the business truly informed?
Then you don’t have Technical Debt
29. You have a mess
Mess (noun)
1. Disorderly accumulation, heap, or jumble
2. A state of embarrassing confusion
3. An unpleasant or difficult situation
30. You have cruft
Cruft (noun)
1. An unpleasant substance
2. The result of shoddy construction
3. Redundant, old or improperly written code
39. “Technical Debt”
in Other Industries
Construction
http://www.constructionmanagementschools.net/wp-content/uploads/2010/04/construction-mistakes-18.jpg
40. “Technical Debt”
in Other Industries
Construction
Reckless and Deliberate
http://www.constructionmanagementschools.net/wp-content/uploads/2010/04/construction-mistakes-18.jpg
41. “Technical Debt”
in Other Industries
Automotive
http://blog.ivman.com/wp-content/HomeRepair.jpg
42. “Technical Debt”
in Other Industries
Automotive
Reckless and Deliberate
http://blog.ivman.com/wp-content/HomeRepair.jpg
43. “Technical Debt”
in Other Industries
Medical
http://www.scientificamerican.com/media/inline/blog/Image/MedicalError.jpg
44. “Technical Debt”
in Other Industries
Medical
Reckless and Inadvertent
http://www.scientificamerican.com/media/inline/blog/Image/MedicalError.jpg
53. Cruft or Debt?
double getSpeed() {
switch (_type) {
case EUROPEAN:
return getBaseSpeed();
case AFRICAN:
return getBaseSpeed() - getLoadFactor() * _numberOfCoconuts;
case NORWEGIAN_BLUE:
return (_isNailed) ? 0 : getBaseSpeed(_voltage);
}
throw new RuntimeException ("Should be unreachable");
}
http://www.refactoring.com/catalog/replaceConditionalWithPolymorphism.html
54. Cruft or Debt?
class Swallow ...
double getSpeed() { return getBaseSpeed(); }
end class
class EuropeanSwallow ...
end class
class AfricanSwallow ...
double getSpeed() { return super.getSpeed - coconutLoad(); }
double coconutLoad() { return getLoadFactor() * _numberOfCoconuts; }
end class
class NorwegianSwallow ...
double getSpeed() { return (_isNailed) ? 0:getBaseSpeed(_voltage); }
end class
56. Messy Code is a Bad Decision
Every Time
You are a professional developer
(Professionals behave ethically)
57. Messy Code is a Bad Decision
Every Time
You are a professional developer
(Professionals behave ethically)
You are going to create unintentional cruft
(You can’t help it. It’s unintentional.)
58. Messy Code is a Bad Decision
Every Time
You are a professional developer
(Professionals behave ethically)
You are going to create unintentional cruft
(You can’t help it. It’s unintentional.)
You have to clean up the existing cruft
(Intent doesn’t alter Responsibility)
61. The Trap
Mess begets mess
Precedent for Speed over Quality
Expectation of increased velocity
Mess slows you down
Must generate more mess to keep up
62. The Trap
Mess begets mess
Precedent for Speed over Quality
Expectation of increased velocity
Mess slows you down
Must generate more mess to keep up
Ask permission to do your job correctly
63. Avoid The Trap
Incremental Fixes Fail
http://www.jacoozi.com/blog/wp-content/uploads/2007/01/refactoring_coc_big.jpg
65. Avoid The Trap
Clean Constantly
Never make an intentional mess
Monitor your “Technical Debt”
Follow the Boy Scout Rule
Quality is your responsibility
66. Avoid The Trap
Clean Constantly
Never make an intentional mess
Monitor your “Technical Debt”
Follow the Boy Scout Rule
Quality is your responsibility
NEVER ask permission to do your job correctly
70. Monitoring Cruft/Debt
Code Coverage
Code exercised by automated tests
Monitor test types separately
Don’t set a coverage target
100% Coverage is a smell
71. Monitoring Cruft/Debt
Code Coverage
Code exercised by automated tests
Monitor test types separately
Don’t set a coverage target
100% Coverage is a smell
Monitor trends, not points
74. Monitoring Cruft/Debt
Cyclomatic Complexity
Number of logical branches in code
Direct relationship with bugs
Typically high in concentrated areas
Reduce Conditionals
Monitor trends, not points
82. Review
Technical Debt
Is a strategic design decision
Requires the business to be informed
Requires a pay-back plan - (Clean Code)
Cruft
83. Review
Technical Debt
Is a strategic design decision
Requires the business to be informed
Requires a pay-back plan - (Clean Code)
Cruft
Happens
Needs to be monitored and cleaned
Is (probably) NOT Technical Debt
85. Thank You!
The Technical Debt Trap
Michael J Norton
@DocOnDev
LeanDog LLC*
doc@leandog.com
*The views expressed are not necessarily the views of LeanDog LLC
(but they could be)
Hinweis der Redaktion
\n
\n
\n
\n
\n
\n
\n
\n
\n
Design decisions that allow for more rapid delivery / illicit quick feedback / gather data necessary to correct design\n
- Sales site for complex product. Create product configuration views.\n- Plan to sell several different products. Starting with just one. Don’t extract interface yet.\n\n\n
- Sales site for complex product. Create product configuration views.\n- Plan to sell several different products. Starting with just one. Don’t extract interface yet.\n\n\n
- Sales site for complex product. Create product configuration views.\n- Plan to sell several different products. Starting with just one. Don’t extract interface yet.\n\n\n
\n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
This is not a loan from a loan shark\n\nHow do we end up in massive high-interest debt unwittingly?\nrobbery or larceny or fraud\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
"We incurred structural debt in order to meet your deadline. We should discuss that debt and set a plan for paying it back later."\n
"We incurred mechanical debt to stay in budget. We should get metrics around that and make sure we pay the debt down in the future."\n
"We incurred health debt during the surgery. You see, it is like we paid for the surgery with a credit card instead of a home equity loan..."\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Not acceptable to violate accounting practices, violate safety laws, or risk patient’s health\n\n
Not acceptable to violate accounting practices, violate safety laws, or risk patient’s health\n\n
Not acceptable to violate accounting practices, violate safety laws, or risk patient’s health\n\n
Not acceptable to violate accounting practices, violate safety laws, or risk patient’s health\n\n
Not acceptable to violate accounting practices, violate safety laws, or risk patient’s health\n\n
Not acceptable to violate accounting practices, violate safety laws, or risk patient’s health\n\n
\n
\n
\n
\n
\n
\n
\n
Ruby - churn => volume of changes\ngit - gitswarm => visual history of changes\nJava - Cobertura or Sonar\n
Ruby - churn => volume of changes\ngit - gitswarm => visual history of changes\nJava - Cobertura or Sonar\n
Ruby - churn => volume of changes\ngit - gitswarm => visual history of changes\nJava - Cobertura or Sonar\n
Ruby - churn => volume of changes\ngit - gitswarm => visual history of changes\nJava - Cobertura or Sonar\n
Ruby - churn => volume of changes\ngit - gitswarm => visual history of changes\nJava - Cobertura or Sonar\n