Credit Crunch CodeTechnical DebtBy Woody Pewittwoody@pewitt.org@woodyp
AgendaDefining Technical DebtWhy Managing Technical Debt is ImportantQuantifying Technical DebtTechnical Debt Anti-Patterns & FixesFinding Technical Debt Using MetricsSummaryFurther  ReadingQuestions.
http://www.flickr.com/photos/robandstephanielevy
Why should do you care?
And who is going to care?
Big ball of mud!A Big Ball of Mud is a haphazardly structured, sprawling, sloppy, duct-tape-and-baling-wire, spaghetti-code jungle.Only those who are unconcerned about architecture, and, perhaps, are comfortable with the inertia of the day-to-day chore of patching the holes in these failing dikes, are content to work on such systems.People who maintain such systems, are often seen wearing socks and sandals.
How to you get them?The Big Ball of Mud and Other Architectural Disastershttp://www.codinghorror.comJeff AtwoodOn Brian Foote & Joseph Yoder's Big Ball of Mud paper
How to you get them?Shantytown, Spaghetti CodeThrowaway CodePiecemeal GrowthKeep It WorkingShearing LayersSweeping It Under The RugReconstruction
Shantytown, Spaghetti Code
Throwaway Code
Piecemeal Growth
Keep It Working
Shearing Layers
Sweeping It Under The Rug
Reconstruction
Steve McConnell's36 classic mistakesPeople MistakesUndermined motivationWeak personnelUncontrolled problem employeesHeroicsAdding people to a late projectNoisy, crowded officesFriction between developers and customersUnrealistic expectationsLack of effective project sponsorshipLack of stakeholder buy-inLack of user inputPolitics placed over substanceWishful thinking
Steve McConnell's36 classic mistakesProcess MistakesOverly optimistic schedulesInsufficient risk managementContractor failureInsufficient planningAbandonment of planning under pressureWasted time during the fuzzy front endShortchanged upstream activitiesInadequate designShortchanged quality assuranceInsufficient management controlsPremature or too frequent convergenceOmitting necessary tasks from estimatesPlanning to catch up laterCode-like-hell programming
Steve McConnell's36 classic mistakesProduct MistakesRequirements gold-platingFeature creepDeveloper gold-platingPush me, pull me negotiationResearch-oriented development
Steve McConnell's36 classic mistakesTechnology MistakesSilver-bullet syndromeOverestimated savings from new tools or methodsSwitching tools in the middle of a projectLack of automated source control
So What is Technical Debt?
Defining TechnicalDebt #1Term coined by Ward Cunningham in 1992Analogous to financial debtFinancial debt = borrow money against a future dateTechnical debt = borrow time against a future date.
Defining TechnicalDebt #2With financial debt“Virtual debt” by not having the best interest rateWith Technical DebtNot making savings against time where possible.
What is Interest OnTechnical Debt?Cost later – cost nowFinancial value of damage to your brandLoss of market shareLow staff morale
Just As Not All FinancialDebt Is Bad
Nor Is All Technical Debt
But Financial Debt CanBe Dangerous
And So CanTechnical Debt
Technical Debt QuadrantDeliberate"We must ship now and deal with consequences""We don't have time for design"PrudentReckless"Now we know how we should have done it""What's Layering"Inadvertent
Classes of Technical DebtPlanned13KnownUnknown24Unplanned
Why Managing Technical Debt is Important?
Why Is Managing TechnicalDebt Important?
Reduce Effort by Keepingit Under Control
Quantifying Technical Debt
Basic FormulaTo Get You StartedWhere:T = Total number of employees involved in paying back the debti = The individual employeeHRi = Hourly rate of pay for that individualHi = The hours that an individual worked in paying back the debtEOC = Employer’s on cost – estimated at 40% of salary = 140%  of salaryHP = Purchase cost of any hardware requiredHI = Installation cost of any hardware requiredSL= Cost of any software licencesX/Bba = An estimate of the damage to brand image.
Rate CardProject Manager = $45 / hourArchitect = $46 / hourLead Developer = $41 / hourDeveloper = $36 / hourTester = $27 / hourTech. Support = $20 / hourBusiness Analyst = $44 / hour.*Hourly rate = average annual salary / (52 – 4wks AL * 5 – 9 days PH * 8 hrs)***Correct as of November ’10. YMMV 
Case Study #1The Anti-Pattern: Waterfall Methodology
The Main Weaknessof Waterfall
Where Does Change Come From?
Why is Change So Costly?
Why Is This Technical Debt?Borrow time now, repay laterTake advantages nowEase in analysing potential changesEase of coordinating large teamsPrecise budgetingRepay laterExtra cost of change.
Quantify the TechnicalDebt: AgileAssume a small error caught during the “paper prototype” phase of an iterationResources deployedArchitect spends 1 hour fixing designTester spends 1/2 hour verifying the fixApply those figures to our formula and:Cost of fixing the error = $82
Quantify the TechnicalDebt: WFNow the same error found in waterfall...Resources deployedArchitect 1 hour fixing designDeveloper spends 4 hours coding solutionLead developer spends ½ hour peer reviewTester spends 2 hours verifying fixApply those figures to our formula and:Cost of fixing the error = $285Value of the technical debt = $203
Potential Cost Per ProjectSo the TD / defect = $202The av. number of defects / project = 283*Potential TD / project = $57,166 *Source: Scan 2006 Benchmark (as of March 2008)
Fixing The Technical DebtI’m not saying prefer Agile over WaterfallI am saying:Be aware of the impact that might have on TDThink about how you are going to combat that:Review earlier in the process where change is cheapEnsure the SME has peer reviewRegular, early checks on design vs. coded solutionDon’t leave all testing to the last phase.
Case Study #2The Anti – Pattern: Not Invented Here
SymptomsDevelopment team spend time developing software which is not core the problem they are trying to solveInstead of buying in a third party solutionThey justify this by saying things like:It doesn’t work the way we need it toIt would take me as long to write as to learn APIThe 3rd party may go bustThe code isn’t good enough quality.
Concrete ExampleDevelopers for a national bank are tasked with creating a new MIS toolThey dedicate 1 developer full time to creating a charting componentThis sucks in testing and PM time tooCharting component not core to task at handSpent 3 months getting nowhereBefore buying a charting component.
Why Is This TechnicalDebt?Savings against time not madeChose to develop a componentShould have bought from a third party.
Quantifying The Technical DebtThe component was bought in the end:Disregard the cost of the componentAnd the time spent learning the APIResources deployed:1 X developer 3 months1 X tester 1.5 months1 X lead developer 1 day1 X PM 1 dayCost of technical debt : $34,050
Fixing The Technical DebtIdentify non core functional aspects of projectFor each of those:Can a component be bought in to achieve it?If so, buy itIf notDoes your enterprise allow open source?If so use itBeware of licence implicationsOnly after evaluating and discounting alternatives should you consider writing your own.
Case Study #3Anti-Pattern: Code that plays together stays together
SymptomsLet’s imagine a “Car” objectWhat properties should it have?MakeModelColourWhat behaviour should it have?None!It’s an inanimate object!A “Car” will have things done to it by “actors”.
What Is The Problem?
Example of Class PollutionCredit: Phil Winstanley (http://weblogs.asp.net/Plip/)
Why Is This TechnicalDebt?Borrow time now, repay laterBorrowed time nowSimpler object graphRepay later in cost of adding functionality.
Concrete ExampleOnline provider wants to be first to marketShips service with monolithic object graphEffort required to add new features growsDevelopment slows to a crawlManagement demand a fix.
Quantifying theTechnical Debt1 monthly iteration to fix this debtResources deployed:5 X Developers1 X lead developer2 X testersApply these figures to our formula and:Cost of technical debt: $61,290.
Fixing The Technical DebtUnderstand thatMonolithic object graph has a limited lifespanPrefer separation of concernsIf first to market is importantUnderstand the value of the technical debt accruedDecide when the debt will be paid offDecide if commercial gain outweighs cost of debtRefactoring tools can reduce “interest” on debt.
Case Study #4The Anti-Pattern: Sensitive Tests
SymptomsTest which are sensitive toContextInterfaceDataPass in one iterationFail in the next due to changes.
Why Is ThisTechnical Debt?Borrow time now, repay laterBorrowed time in the form of easy to write testsRepay later in form of fixing sensitive tests.
Concrete ExampleTester testing code which uses data from development databaseDeveloper adds new functionalityShape of the database changesValues in the database changePreviously passing tests failTests rewritten using current dev. database.
Quantifying theTechnical DebtTake previous 283 defects per projectAssume 10% of tests for those defects are data dependantAssume it takes tester 30 minutes to fix each test28 * 0.5 = 14 hoursApply those figures to our formula and:Technical debt = $536.35.
Fixing TheTechnical DebtTest must use independent dataDon’t run tests against development dataEitherHave a dedicated test databaseOr it may be possible to mock data access Or have the set up code for each test or suite of tests generate the data it requires and drop it during the tear down code.
How Do We SpotTechnical Debt?
We Are Used to Charting Progress
Time Budget FailuresAre Obvious
Effect #1Loss of Productivity
Effect #1Loss of Productivity
Effect #2Increase In Testing
Effect #2Increase In Testing
Effect #3Decrease In Morale
Effect #3Decrease In Morale
SummaryIn this presentation you learned:What technical debt isThat it is important to manage technical debtSome common anti-patterns and how to fix themMetrics to spot hidden technical debtHow to quantify technical debt.
Take AwayIf you only take away one thingKnow that technical debt isthe silent killer that stalks all projectsDon’t let it kill your projects!

Technical debt

  • 1.
    Credit Crunch CodeTechnicalDebtBy Woody Pewittwoody@pewitt.org@woodyp
  • 2.
    AgendaDefining Technical DebtWhyManaging Technical Debt is ImportantQuantifying Technical DebtTechnical Debt Anti-Patterns & FixesFinding Technical Debt Using MetricsSummaryFurther ReadingQuestions.
  • 3.
  • 4.
    Why should doyou care?
  • 5.
    And who isgoing to care?
  • 7.
    Big ball ofmud!A Big Ball of Mud is a haphazardly structured, sprawling, sloppy, duct-tape-and-baling-wire, spaghetti-code jungle.Only those who are unconcerned about architecture, and, perhaps, are comfortable with the inertia of the day-to-day chore of patching the holes in these failing dikes, are content to work on such systems.People who maintain such systems, are often seen wearing socks and sandals.
  • 8.
    How to youget them?The Big Ball of Mud and Other Architectural Disastershttp://www.codinghorror.comJeff AtwoodOn Brian Foote & Joseph Yoder's Big Ball of Mud paper
  • 9.
    How to youget them?Shantytown, Spaghetti CodeThrowaway CodePiecemeal GrowthKeep It WorkingShearing LayersSweeping It Under The RugReconstruction
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
    Steve McConnell's36 classicmistakesPeople MistakesUndermined motivationWeak personnelUncontrolled problem employeesHeroicsAdding people to a late projectNoisy, crowded officesFriction between developers and customersUnrealistic expectationsLack of effective project sponsorshipLack of stakeholder buy-inLack of user inputPolitics placed over substanceWishful thinking
  • 18.
    Steve McConnell's36 classicmistakesProcess MistakesOverly optimistic schedulesInsufficient risk managementContractor failureInsufficient planningAbandonment of planning under pressureWasted time during the fuzzy front endShortchanged upstream activitiesInadequate designShortchanged quality assuranceInsufficient management controlsPremature or too frequent convergenceOmitting necessary tasks from estimatesPlanning to catch up laterCode-like-hell programming
  • 19.
    Steve McConnell's36 classicmistakesProduct MistakesRequirements gold-platingFeature creepDeveloper gold-platingPush me, pull me negotiationResearch-oriented development
  • 20.
    Steve McConnell's36 classicmistakesTechnology MistakesSilver-bullet syndromeOverestimated savings from new tools or methodsSwitching tools in the middle of a projectLack of automated source control
  • 21.
    So What isTechnical Debt?
  • 22.
    Defining TechnicalDebt #1Termcoined by Ward Cunningham in 1992Analogous to financial debtFinancial debt = borrow money against a future dateTechnical debt = borrow time against a future date.
  • 23.
    Defining TechnicalDebt #2Withfinancial debt“Virtual debt” by not having the best interest rateWith Technical DebtNot making savings against time where possible.
  • 24.
    What is InterestOnTechnical Debt?Cost later – cost nowFinancial value of damage to your brandLoss of market shareLow staff morale
  • 25.
    Just As NotAll FinancialDebt Is Bad
  • 26.
    Nor Is AllTechnical Debt
  • 27.
    But Financial DebtCanBe Dangerous
  • 28.
  • 29.
    Technical Debt QuadrantDeliberate"Wemust ship now and deal with consequences""We don't have time for design"PrudentReckless"Now we know how we should have done it""What's Layering"Inadvertent
  • 30.
    Classes of TechnicalDebtPlanned13KnownUnknown24Unplanned
  • 31.
    Why Managing TechnicalDebt is Important?
  • 32.
    Why Is ManagingTechnicalDebt Important?
  • 33.
    Reduce Effort byKeepingit Under Control
  • 34.
  • 35.
    Basic FormulaTo GetYou StartedWhere:T = Total number of employees involved in paying back the debti = The individual employeeHRi = Hourly rate of pay for that individualHi = The hours that an individual worked in paying back the debtEOC = Employer’s on cost – estimated at 40% of salary = 140% of salaryHP = Purchase cost of any hardware requiredHI = Installation cost of any hardware requiredSL= Cost of any software licencesX/Bba = An estimate of the damage to brand image.
  • 36.
    Rate CardProject Manager= $45 / hourArchitect = $46 / hourLead Developer = $41 / hourDeveloper = $36 / hourTester = $27 / hourTech. Support = $20 / hourBusiness Analyst = $44 / hour.*Hourly rate = average annual salary / (52 – 4wks AL * 5 – 9 days PH * 8 hrs)***Correct as of November ’10. YMMV 
  • 37.
    Case Study #1TheAnti-Pattern: Waterfall Methodology
  • 38.
  • 39.
  • 40.
    Why is ChangeSo Costly?
  • 41.
    Why Is ThisTechnical Debt?Borrow time now, repay laterTake advantages nowEase in analysing potential changesEase of coordinating large teamsPrecise budgetingRepay laterExtra cost of change.
  • 42.
    Quantify the TechnicalDebt:AgileAssume a small error caught during the “paper prototype” phase of an iterationResources deployedArchitect spends 1 hour fixing designTester spends 1/2 hour verifying the fixApply those figures to our formula and:Cost of fixing the error = $82
  • 43.
    Quantify the TechnicalDebt:WFNow the same error found in waterfall...Resources deployedArchitect 1 hour fixing designDeveloper spends 4 hours coding solutionLead developer spends ½ hour peer reviewTester spends 2 hours verifying fixApply those figures to our formula and:Cost of fixing the error = $285Value of the technical debt = $203
  • 44.
    Potential Cost PerProjectSo the TD / defect = $202The av. number of defects / project = 283*Potential TD / project = $57,166 *Source: Scan 2006 Benchmark (as of March 2008)
  • 45.
    Fixing The TechnicalDebtI’m not saying prefer Agile over WaterfallI am saying:Be aware of the impact that might have on TDThink about how you are going to combat that:Review earlier in the process where change is cheapEnsure the SME has peer reviewRegular, early checks on design vs. coded solutionDon’t leave all testing to the last phase.
  • 46.
    Case Study #2TheAnti – Pattern: Not Invented Here
  • 47.
    SymptomsDevelopment team spendtime developing software which is not core the problem they are trying to solveInstead of buying in a third party solutionThey justify this by saying things like:It doesn’t work the way we need it toIt would take me as long to write as to learn APIThe 3rd party may go bustThe code isn’t good enough quality.
  • 48.
    Concrete ExampleDevelopers fora national bank are tasked with creating a new MIS toolThey dedicate 1 developer full time to creating a charting componentThis sucks in testing and PM time tooCharting component not core to task at handSpent 3 months getting nowhereBefore buying a charting component.
  • 49.
    Why Is ThisTechnicalDebt?Savings against time not madeChose to develop a componentShould have bought from a third party.
  • 50.
    Quantifying The TechnicalDebtThe component was bought in the end:Disregard the cost of the componentAnd the time spent learning the APIResources deployed:1 X developer 3 months1 X tester 1.5 months1 X lead developer 1 day1 X PM 1 dayCost of technical debt : $34,050
  • 51.
    Fixing The TechnicalDebtIdentify non core functional aspects of projectFor each of those:Can a component be bought in to achieve it?If so, buy itIf notDoes your enterprise allow open source?If so use itBeware of licence implicationsOnly after evaluating and discounting alternatives should you consider writing your own.
  • 52.
    Case Study #3Anti-Pattern:Code that plays together stays together
  • 53.
    SymptomsLet’s imagine a“Car” objectWhat properties should it have?MakeModelColourWhat behaviour should it have?None!It’s an inanimate object!A “Car” will have things done to it by “actors”.
  • 54.
    What Is TheProblem?
  • 55.
    Example of ClassPollutionCredit: Phil Winstanley (http://weblogs.asp.net/Plip/)
  • 56.
    Why Is ThisTechnicalDebt?Borrow time now, repay laterBorrowed time nowSimpler object graphRepay later in cost of adding functionality.
  • 57.
    Concrete ExampleOnline providerwants to be first to marketShips service with monolithic object graphEffort required to add new features growsDevelopment slows to a crawlManagement demand a fix.
  • 58.
    Quantifying theTechnical Debt1monthly iteration to fix this debtResources deployed:5 X Developers1 X lead developer2 X testersApply these figures to our formula and:Cost of technical debt: $61,290.
  • 59.
    Fixing The TechnicalDebtUnderstand thatMonolithic object graph has a limited lifespanPrefer separation of concernsIf first to market is importantUnderstand the value of the technical debt accruedDecide when the debt will be paid offDecide if commercial gain outweighs cost of debtRefactoring tools can reduce “interest” on debt.
  • 60.
    Case Study #4TheAnti-Pattern: Sensitive Tests
  • 61.
    SymptomsTest which aresensitive toContextInterfaceDataPass in one iterationFail in the next due to changes.
  • 62.
    Why Is ThisTechnicalDebt?Borrow time now, repay laterBorrowed time in the form of easy to write testsRepay later in form of fixing sensitive tests.
  • 63.
    Concrete ExampleTester testingcode which uses data from development databaseDeveloper adds new functionalityShape of the database changesValues in the database changePreviously passing tests failTests rewritten using current dev. database.
  • 64.
    Quantifying theTechnical DebtTakeprevious 283 defects per projectAssume 10% of tests for those defects are data dependantAssume it takes tester 30 minutes to fix each test28 * 0.5 = 14 hoursApply those figures to our formula and:Technical debt = $536.35.
  • 65.
    Fixing TheTechnical DebtTestmust use independent dataDon’t run tests against development dataEitherHave a dedicated test databaseOr it may be possible to mock data access Or have the set up code for each test or suite of tests generate the data it requires and drop it during the tear down code.
  • 66.
    How Do WeSpotTechnical Debt?
  • 67.
    We Are Usedto Charting Progress
  • 68.
  • 69.
    Effect #1Loss ofProductivity
  • 70.
    Effect #1Loss ofProductivity
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
    SummaryIn this presentationyou learned:What technical debt isThat it is important to manage technical debtSome common anti-patterns and how to fix themMetrics to spot hidden technical debtHow to quantify technical debt.
  • 76.
    Take AwayIf youonly take away one thingKnow that technical debt isthe silent killer that stalks all projectsDon’t let it kill your projects!

Editor's Notes

  • #5 To help management understand the cost of a…
  • #9 http://www.codinghorror.com/blog/2007/11/the-big-ball-of-mud-and-other-architectural-disasters.html
  • #21 I've increasingly come to believe the only difference between experienced and inexperienced software developers is that the experienced ones realize when they're making mistakes. The same rule applies to software projects and project managers. If you're not actively scanning through the list of Classic Software Development Mistakes as you run your software project, you have no idea how likely it is you're making one of these mistakes right now.
  • #28 In the current downturn lots of companies carried low amounts of well managed financial debt and still went bankrupt when their, previously stable, line of credit was withdrawn by the banks.
  • #29 Unforeseen things happenTeam members get:SickMove to other rolesBetter job offersYour market can:CollapseGain a new competitorExpand faster than you thought
  • #33 Cost per feature over time
  • #34 Cost per feature over time
  • #35 Bad news: Quantifying Technical Debt is hardGood news: Doesn’t matter how you do itProvided:It’s meaningful to your enterpriseYou are consistent.
  • #67 You can’t see technical debtSo how do spot something you can’t see?Astronomers have the same problemPlanets that could support life can’t be seen:Life supporting planets must be close to starsThe light from the star hides the planetSo how to they spot the planets?They look for the effect the hidden planet hasWe can do the same with technical debt.