Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Loving Legacy Code

Keith Pitty
February 05, 2015

Loving Legacy Code

Are you approaching the challenge of working with legacy code with helpful techniques and a good attitude?

Accompanying blog post at http://keithpitty.com/blog/archives/2015-02-06-loving-legacy-code

Presented at RubyConf Australia on 5 February, 2015.

Keith Pitty

February 05, 2015

More Decks by Keith Pitty

Other Decks in Programming


  1. Loving Legacy Code Keith Pitty

  2. Loving legacy code?

  3. Seriously?

  4. Do you love legacy code?

  5. Legacy deserves respect!

  6. More love!

  7. Approach Techniques Attitude

  8. What is legacy code?

  9. No tests? What is legacy code?

  10. Impedes change What is legacy code?

  11. Why so negative?

  12. Technical debt? Why so negative?

  13. Poor design Why so negative?

  14. Obfuscation Why so negative?

  15. Counterproductive tests Why so negative?

  16. No “shiny” tech? Why so negative?

  17. Tender loving care

  18. OK, maybe beyond TLC

  19. Or maybe not …

  20. Original developers?

  21. Understand why Original developers?

  22. Respect Original developers?

  23. Learn from mistakes Original developers?

  24. Approach Techniques Attitude

  25. Pain points

  26. Customer feedback Pain points

  27. Monitoring tools Pain points

  28. Listen to developers Pain points

  29. Measure code quality Pain points

  30. Nursing legacy code

  31. Version control! Nursing legacy code

  32. Testing

  33. No tests? Nursing legacy code: testing

  34. Unit tests Nursing legacy code: testing

  35. Fast feedback Nursing legacy code: testing

  36. Break dependencies Nursing legacy code: testing

  37. Nurture tests Nursing legacy code: testing

  38. Remove tests? Nursing legacy code: testing

  39. Nurture CI builds Nursing legacy code: testing

  40. Refactoring

  41. Refactor judiciously Nursing legacy code: refactoring

  42. Separate concerns Nursing legacy code: refactoring

  43. e.g. Rails models Nursing legacy code: refactoring

  44. Nursing legacy code

  45. Service classes Nursing legacy code: refactoring

  46. “Best” Practices Nursing legacy code: refactoring

  47. Simplify design Nursing legacy code: refactoring

  48. 1. Tests pass 2. Expresses intent 3. No duplication 4.

    Small Nursing legacy code: refactoring
  49. “Remove duplication and improve names in small cycles.” — JB

    Rainsberger Nursing legacy code: refactoring
  50. Less code Nursing legacy code: refactoring

  51. Satisfaction Nursing legacy code: refactoring

  52. Design Opportunities Nursing legacy code: refactoring

  53. Tool support

  54. Nursing legacy code: tool support

  55. RuboCop Nursing legacy code: tool support

  56. Other open source Section

  57. Automate workflow Nursing legacy code: tool support

  58. Managing legacy code

  59. Invest wisely Managing legacy code

  60. Maintenance effort Managing legacy code

  61. Maintenance budget Managing legacy code

  62. If necessary … Managing legacy code

  63. migrate away Managing legacy code

  64. Approach Techniques Attitude

  65. Approach Techniques Attitude

  66. Managers

  67. Devote resources Managers

  68. Listen to developers Managers

  69. Respect Managers

  70. Share support roles Managers

  71. Developers

  72. Share knowledge Developers

  73. GitHub PRs Developers

  74. Future Developers

  75. Language Developers

  76. Respect past Developers

  77. No codebase is perfect Developers

  78. Listen to managers Developers

  79. Respect Developers

  80. Metaphors

  81. Nursing Metaphors

  82. Gardening Metaphors

  83. Renovation Metaphors

  84. Conclusion

  85. Loving legacy code …

  86. can be rewarding

  87. Respect

  88. Thanks for listening!

  89. Keith Pitty @keithpitty