Technical debt


Published on

This is my slides I used for my DevConnections Technical debt talk.

  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • To help management understand the cost of a…
  • 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.
  • 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.
  • Unforeseen things happenTeam members get:SickMove to other rolesBetter job offersYour market can:CollapseGain a new competitorExpand faster than you thought
  • Cost per feature over time
  • Cost per feature over time
  • Bad news: Quantifying Technical Debt is hardGood news: Doesn’t matter how you do itProvided:It’s meaningful to your enterpriseYou are consistent.
  • 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.
  • Technical debt

    1. 1. Credit Crunch CodeTechnical Debt<br />By Woody Pewitt<br /><br />@woodyp<br />
    2. 2. Agenda<br />Defining Technical Debt<br />Why Managing Technical Debt is Important<br />Quantifying Technical Debt<br />Technical Debt Anti-Patterns & Fixes<br />Finding Technical Debt Using Metrics<br />Summary<br />Further Reading<br />Questions.<br />
    3. 3.<br />
    4. 4. Why should do you care?<br />
    5. 5. And who is going to care?<br />
    6. 6.
    7. 7. Big ball of mud!<br />A Big Ball of Mud is a haphazardly structured, sprawling, sloppy, duct-tape-and-baling-wire, spaghetti-code jungle.<br />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.<br />People who maintain such systems, are often seen wearing socks and sandals.<br />
    8. 8. How to you get them?<br />The Big Ball of Mud and Other Architectural Disasters<br /><br />Jeff Atwood<br />On Brian Foote & Joseph Yoder's Big Ball of Mud paper<br />
    9. 9. How to you get them?<br />Shantytown, Spaghetti Code<br />Throwaway Code<br />Piecemeal Growth<br />Keep It Working<br />Shearing Layers<br />Sweeping It Under The Rug<br />Reconstruction<br />
    10. 10. Shantytown, Spaghetti Code<br />
    11. 11. Throwaway Code<br />
    12. 12. Piecemeal Growth<br />
    13. 13. Keep It Working<br />
    14. 14. Shearing Layers<br />
    15. 15. Sweeping It Under The Rug<br />
    16. 16. Reconstruction<br />
    17. 17. Steve McConnell's36 classic mistakes<br />People Mistakes<br />Undermined motivation<br />Weak personnel<br />Uncontrolled problem employees<br />Heroics<br />Adding people to a late project<br />Noisy, crowded offices<br />Friction between developers and customers<br />Unrealistic expectations<br />Lack of effective project sponsorship<br />Lack of stakeholder buy-in<br />Lack of user input<br />Politics placed over substance<br />Wishful thinking<br />
    18. 18. Steve McConnell's36 classic mistakes<br />Process Mistakes<br />Overly optimistic schedules<br />Insufficient risk management<br />Contractor failure<br />Insufficient planning<br />Abandonment of planning under pressure<br />Wasted time during the fuzzy front end<br />Shortchanged upstream activities<br />Inadequate design<br />Shortchanged quality assurance<br />Insufficient management controls<br />Premature or too frequent convergence<br />Omitting necessary tasks from estimates<br />Planning to catch up later<br />Code-like-hell programming<br />
    19. 19. Steve McConnell's36 classic mistakes<br />Product Mistakes<br />Requirements gold-plating<br />Feature creep<br />Developer gold-plating<br />Push me, pull me negotiation<br />Research-oriented development<br />
    20. 20. Steve McConnell's36 classic mistakes<br />Technology Mistakes<br />Silver-bullet syndrome<br />Overestimated savings from new tools or methods<br />Switching tools in the middle of a project<br />Lack of automated source control<br />
    21. 21. So What is Technical Debt?<br />
    22. 22. Defining TechnicalDebt #1<br />Term coined by Ward Cunningham in 1992<br />Analogous to financial debt<br />Financial debt = borrow money against a future date<br />Technical debt = borrow time against a future date.<br />
    23. 23. Defining TechnicalDebt #2<br />With financial debt<br />“Virtual debt” by not having the best interest rate<br />With Technical Debt<br />Not making savings against time where possible.<br />
    24. 24. What is Interest OnTechnical Debt?<br />Cost later – cost now<br />Financial value of damage to your brand<br />Loss of market share<br />Low staff morale<br />
    25. 25. Just As Not All FinancialDebt Is Bad<br />
    26. 26. Nor Is All Technical Debt<br />
    27. 27. But Financial Debt CanBe Dangerous<br />
    28. 28. And So CanTechnical Debt<br />
    29. 29. Technical Debt Quadrant<br />Deliberate<br />"We must ship now and deal with consequences"<br />"We don't have time for design"<br />Prudent<br />Reckless<br />"Now we know how we should have done it"<br />"What's Layering"<br />Inadvertent<br />
    30. 30. Classes of Technical Debt<br />Planned<br />1<br />3<br />Known<br />Unknown<br />2<br />4<br />Unplanned<br />
    31. 31. Why Managing Technical Debt is Important?<br />
    32. 32. Why Is Managing TechnicalDebt Important?<br />
    33. 33. Reduce Effort by Keepingit Under Control<br />
    34. 34. Quantifying Technical Debt<br />
    35. 35. Basic FormulaTo Get You Started<br />Where:<br />T = Total number of employees involved in paying back the debt<br />i = The individual employee<br />HRi = Hourly rate of pay for that individual<br />Hi = The hours that an individual worked in paying back the debt<br />EOC = Employer’s on cost – estimated at 40% of salary = 140% of salary<br />HP = Purchase cost of any hardware required<br />HI = Installation cost of any hardware required<br />SL= Cost of any software licences<br />X/Bba = An estimate of the damage to brand image.<br />
    36. 36. Rate Card<br />Project Manager = $45 / hour<br />Architect = $46 / hour<br />Lead Developer = $41 / hour<br />Developer = $36 / hour<br />Tester = $27 / hour<br />Tech. Support = $20 / hour<br />Business Analyst = $44 / hour.<br />*Hourly rate = average annual salary / (52 – 4wks AL * 5 – 9 days PH * 8 hrs)<br />***Correct as of November ’10. YMMV <br />
    37. 37. Case Study #1<br />The Anti-Pattern: Waterfall Methodology<br />
    38. 38. The Main Weaknessof Waterfall<br />
    39. 39. Where Does Change Come From?<br />
    40. 40. Why is Change So Costly?<br />
    41. 41. Why Is This Technical Debt?<br />Borrow time now, repay later<br />Take advantages now<br />Ease in analysing potential changes<br />Ease of coordinating large teams<br />Precise budgeting<br />Repay later<br />Extra cost of change.<br />
    42. 42. Quantify the TechnicalDebt: Agile<br />Assume a small error caught during the “paper prototype” phase of an iteration<br />Resources deployed<br />Architect spends 1 hour fixing design<br />Tester spends 1/2 hour verifying the fix<br />Apply those figures to our formula and:<br />Cost of fixing the error = $82<br />
    43. 43. Quantify the TechnicalDebt: WF<br />Now the same error found in waterfall...<br />Resources deployed<br />Architect 1 hour fixing design<br />Developer spends 4 hours coding solution<br />Lead developer spends ½ hour peer review<br />Tester spends 2 hours verifying fix<br />Apply those figures to our formula and:<br />Cost of fixing the error = $285<br />Value of the technical debt = $203<br />
    44. 44. Potential Cost Per Project<br />So the TD / defect = $202<br />The av. number of defects / project = 283*<br />Potential TD / project = $57,166 <br />*Source: Scan 2006 Benchmark (as of March 2008)<br />
    45. 45. Fixing The Technical Debt<br />I’m not saying prefer Agile over Waterfall<br />I am saying:<br />Be aware of the impact that might have on TD<br />Think about how you are going to combat that:<br />Review earlier in the process where change is cheap<br />Ensure the SME has peer review<br />Regular, early checks on design vs. coded solution<br />Don’t leave all testing to the last phase.<br />
    46. 46. Case Study #2<br />The Anti – Pattern: Not Invented Here<br />
    47. 47. Symptoms<br />Development team spend time developing software which is not core the problem they are trying to solve<br />Instead of buying in a third party solution<br />They justify this by saying things like:<br />It doesn’t work the way we need it to<br />It would take me as long to write as to learn API<br />The 3rd party may go bust<br />The code isn’t good enough quality.<br />
    48. 48. Concrete Example<br />Developers for a national bank are tasked with creating a new MIS tool<br />They dedicate 1 developer full time to creating a charting component<br />This sucks in testing and PM time too<br />Charting component not core to task at hand<br />Spent 3 months getting nowhere<br />Before buying a charting component.<br />
    49. 49. Why Is This TechnicalDebt?<br />Savings against time not made<br />Chose to develop a component<br />Should have bought from a third party.<br />
    50. 50. Quantifying The Technical Debt<br />The component was bought in the end:<br />Disregard the cost of the component<br />And the time spent learning the API<br />Resources deployed:<br />1 X developer 3 months<br />1 X tester 1.5 months<br />1 X lead developer 1 day<br />1 X PM 1 day<br />Cost of technical debt : $34,050<br />
    51. 51. Fixing The Technical Debt<br />Identify non core functional aspects of project<br />For each of those:<br />Can a component be bought in to achieve it?<br />If so, buy it<br />If not<br />Does your enterprise allow open source?<br />If so use it<br />Beware of licence implications<br />Only after evaluating and discounting alternatives should you consider writing your own.<br />
    52. 52. Case Study #3<br />Anti-Pattern: Code that plays together stays together<br />
    53. 53. Symptoms<br />Let’s imagine a “Car” object<br />What properties should it have?<br />Make<br />Model<br />Colour<br />What behaviour should it have?<br />None!<br />It’s an inanimate object!<br />A “Car” will have things done to it by “actors”.<br />
    54. 54. What Is The Problem?<br />
    55. 55. Example of Class Pollution<br />Credit: Phil Winstanley (<br />
    56. 56. Why Is This TechnicalDebt?<br />Borrow time now, repay later<br />Borrowed time now<br />Simpler object graph<br />Repay later in cost of adding functionality.<br />
    57. 57. Concrete Example<br />Online provider wants to be first to market<br />Ships service with monolithic object graph<br />Effort required to add new features grows<br />Development slows to a crawl<br />Management demand a fix.<br />
    58. 58. Quantifying theTechnical Debt<br />1 monthly iteration to fix this debt<br />Resources deployed:<br />5 X Developers<br />1 X lead developer<br />2 X testers<br />Apply these figures to our formula and:<br />Cost of technical debt: $61,290.<br />
    59. 59. Fixing The Technical Debt<br />Understand that<br />Monolithic object graph has a limited lifespan<br />Prefer separation of concerns<br />If first to market is important<br />Understand the value of the technical debt accrued<br />Decide when the debt will be paid off<br />Decide if commercial gain outweighs cost of debt<br />Refactoring tools can reduce “interest” on debt.<br />
    60. 60. Case Study #4<br />The Anti-Pattern: Sensitive Tests<br />
    61. 61. Symptoms<br />Test which are sensitive to<br />Context<br />Interface<br />Data<br />Pass in one iteration<br />Fail in the next due to changes.<br />
    62. 62. Why Is ThisTechnical Debt?<br />Borrow time now, repay later<br />Borrowed time in the form of easy to write tests<br />Repay later in form of fixing sensitive tests.<br />
    63. 63. Concrete Example<br />Tester testing code which uses data from development database<br />Developer adds new functionality<br />Shape of the database changes<br />Values in the database change<br />Previously passing tests fail<br />Tests rewritten using current dev. database.<br />
    64. 64. Quantifying theTechnical Debt<br />Take previous 283 defects per project<br />Assume 10% of tests for those defects are data dependant<br />Assume it takes tester 30 minutes to fix each test<br />28 * 0.5 = 14 hours<br />Apply those figures to our formula and:<br />Technical debt = $536.35.<br />
    65. 65. Fixing TheTechnical Debt<br />Test must use independent data<br />Don’t run tests against development data<br />Either<br />Have a dedicated test database<br />Or it may be possible to mock data access <br />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.<br />
    66. 66. How Do We SpotTechnical Debt?<br />
    67. 67. We Are Used to Charting Progress<br />
    68. 68. Time Budget FailuresAre Obvious<br />
    69. 69. Effect #1Loss of Productivity<br />
    70. 70. Effect #1Loss of Productivity<br />
    71. 71. Effect #2Increase In Testing<br />
    72. 72. Effect #2Increase In Testing<br />
    73. 73. Effect #3Decrease In Morale<br />
    74. 74. Effect #3Decrease In Morale<br />
    75. 75. Summary<br />In this presentation you learned:<br />What technical debt is<br />That it is important to manage technical debt<br />Some common anti-patterns and how to fix them<br />Metrics to spot hidden technical debt<br />How to quantify technical debt.<br />
    76. 76. Take Away<br />If you only take away one thing<br />Know that technical debt is<br />the silent killer that stalks all projects<br />Don’t let it kill your projects!<br />
    77. 77. Further Reading<br /><br /><br /><br /><br />
    78. 78. Questions?<br />There wasn’t time for my question<br />Where can I contact you?<br /> <br /><br />@woodyp<br />
    79. 79. Thank You!<br />By Woody Pewitt<br /><br /><br />@woodyp<br />