Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
MUD TIRES: GETTINGTRACTION IN LEGACY CODE                                     o r y_  f oy  Cory Foy                      ...
http://www.flickr.com/photos/countylemonade/5417832718
WHAT IS LEGACY CODE?
WHAT IS LEGACY CODE?• Code   we’ve gotten from somewhere else
WHAT IS LEGACY CODE?• Code   we’ve gotten from somewhere else• Code   we have to change, but don’t understand
WHAT IS LEGACY CODE?• Code   we’ve gotten from somewhere else• Code   we have to change, but don’t understand• Demoralizin...
WHAT IS LEGACY CODE?• Code   we’ve gotten from somewhere else• Code   we have to change, but don’t understand• Demoralizin...
WHAT IS LEGACY CODE?• Code   we’ve gotten from somewhere else• Code   we have to change, but don’t understand• Demoralizin...
http://www.flickr.com/photos/futureshape/2614476028
Preparing to AddBehavior
Adding            BehaviorPreparing to AddBehavior
Adding            BehaviorPreparing                       Removing to Add                       DuplicationBehavior
Cleaning            Technical              Debt             Adding            BehaviorPreparing                        Rem...
Cleaning            Technical              Debt             Adding            BehaviorPreparing                        Rem...
Cleaning                       Technical                         Debt                        Adding                       ...
Cleaning                      Technical                        Debt                       Adding                      Beha...
R e mo d e li ng   Cleaning                              Technical                                Debt                    ...
R e mo d e li ng   Cleaning                              Technical                                Debt                    ...
http://www.flickr.com/photos/marcwathieu/4074508950
Tools   Strategies        Approaches                 http://www.flickr.com/photos/marcwathieu/4074508950
http://www.flickr.com/photos/pitel/1406292257
http://www.flickr.com/photos/pitel/1406292257
http://www.flickr.com/photos/pitel/1406292257
http://www.flickr.com/photos/pitel/1406292257
http://www.flickr.com/photos/pitel/1406292257
http://www.flickr.com/photos/pitel/1406292257
http://www.flickr.com/photos/pitel/1406292257
http://www.flickr.com/photos/pitel/1406292257
ra te g ie sSt                                 Naked CRC  Acceptance Test-Driven Development                    Test-Drive...
ra te g ie sSt                                 Naked CRC  Acceptance Test-Driven Development                    Test-Drive...
ra te g ie sSt   Making Changes  Acceptance Test-Driven Development  Test-Driven Development  Refactoring                 ...
Tell the Story      Naked CRChttp://www.flickr.com/photos/ransomtech/5811447011
Tell the Story
Naked CRC
Increasing Confidence  Sensing VariablesCharacterization Tests Pair Programming                         http://www.flickr.co...
Sensing Variableshttp://www.artima.com/weblogs/viewpost.jsp?thread=170799
Sensing Variableshttp://www.artima.com/weblogs/viewpost.jsp?thread=170799
Sensing Variableshttp://www.artima.com/weblogs/viewpost.jsp?thread=170799
Characterization Testshttp://www.artima.com/weblogs/viewpost.jsp?thread=170799
Characterization Testshttp://www.artima.com/weblogs/viewpost.jsp?thread=170799
Characterization Testshttp://www.artima.com/weblogs/viewpost.jsp?thread=170799
You need to                                         ATDD                                                        TDD       ...
R e mo d e li ng   Cleaning                              Technical                                Debt                    ...
R e mo d e li ng   Cleaning                ATDD                              Technical                                Debt...
R e mo d e li ng   Cleaning                ATDD                              Technical                TDD                 ...
R e mo d e li ng   Cleaning               ATDD                              Technical               TDD                   ...
Example: Acceptance TDD Basic Employee Compensation Each week, hourly employees are paid   • A standard wage per hour for ...
Example: Acceptance TDD Basic Employee Compensation Each week, hourly employees are paid   • A standard wage per hour for ...
Example: Acceptance TDD Basic Employee Compensation Each week, hourly employees are paid   • A standard wage per hour for ...
http://www.fitnesse.org
http://www.fitnesse.org
http://www.fitnesse.org
http://www.fitnesse.org
A test is not a unit test if:- It talks to the database- It communicates across the network- It touches the file system- It...
http://vinkamat.com/2011/tdd-unit-testing-and-benefits/
Redhttp://vinkamat.com/2011/tdd-unit-testing-and-benefits/
RedGreenhttp://vinkamat.com/2011/tdd-unit-testing-and-benefits/
RedGreenRefactorhttp://vinkamat.com/2011/tdd-unit-testing-and-benefits/
(Refactoring is a) disciplined technique forrestructuring an existing body of code, alteringits internal structure without...
Feather’s Approach ATDD Approach   Edit and Pray                     http://www.flickr.com/photos/phluke/62175794
Feather’s Approach
Feather’s ApproachIdentifyChange Points
Feather’s ApproachIdentifyChange PointsFind Test  Points
Feather’s ApproachIdentifyChange PointsFind Test  Points    Break Dependencie      s
Feather’s ApproachIdentifyChange                Write Points               TestsFind Test  Points    Break Dependencie    ...
Feather’s ApproachIdentifyChange                Write Points               TestsFind Test  Points           Make          ...
Feather’s ApproachIdentifyChange                Write Points               TestsFind Test  Points           Make          ...
ATDD Approach
Write     ATDD ApproachAcceptance   Tests
Write                        ATDD ApproachAcceptance   Tests          Write             Characterization                  ...
Write                           ATDD ApproachAcceptance   Tests             Write                Characterization         ...
Write                              ATDD ApproachAcceptance   Tests             Write                Characterization      ...
Write                              ATDD ApproachAcceptance   Tests             Write                Characterization      ...
Write                              ATDD ApproachAcceptance   Tests             Write                Characterization      ...
Write                              ATDD ApproachAcceptance   Tests             Write                Characterization      ...
Write                              ATDD ApproachAcceptance   Tests             Write                Characterization      ...
e fe re n ce sRCory Foyfoyc@coryfoy.com@cory_foycory.foy@netobjectives.com   http://www.flickr.com/photos/or4n6e/4827075541
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Upcoming SlideShare
Loading in …5
×

Mud Tires: Getting Traction in Legacy Code

1,904 views

Published on

In this talk from the Tampa IASA User Group, Cory Foy gives Tools, Strategies and Approaches for dealing with Legacy Code.

  • Be the first to comment

Mud Tires: Getting Traction in Legacy Code

  1. 1. MUD TIRES: GETTINGTRACTION IN LEGACY CODE o r y_ f oy Cory Foy @ c i ve s .c om Senior Consultant e tob je c t Net Objectives y.f o y@n f oy .c om cor lo g. cor y ht p:/ b t / http://www.flickr.com/photos/or4n6e/4827075541
  2. 2. http://www.flickr.com/photos/countylemonade/5417832718
  3. 3. WHAT IS LEGACY CODE?
  4. 4. WHAT IS LEGACY CODE?• Code we’ve gotten from somewhere else
  5. 5. WHAT IS LEGACY CODE?• Code we’ve gotten from somewhere else• Code we have to change, but don’t understand
  6. 6. WHAT IS LEGACY CODE?• Code we’ve gotten from somewhere else• Code we have to change, but don’t understand• Demoralizing Code (Big Ball of Mud)
  7. 7. WHAT IS LEGACY CODE?• Code we’ve gotten from somewhere else• Code we have to change, but don’t understand• Demoralizing Code (Big Ball of Mud)• Code without automated unit tests
  8. 8. WHAT IS LEGACY CODE?• Code we’ve gotten from somewhere else• Code we have to change, but don’t understand• Demoralizing Code (Big Ball of Mud)• Code without automated unit tests• Any code older than about 2 hours
  9. 9. http://www.flickr.com/photos/futureshape/2614476028
  10. 10. Preparing to AddBehavior
  11. 11. Adding BehaviorPreparing to AddBehavior
  12. 12. Adding BehaviorPreparing Removing to Add DuplicationBehavior
  13. 13. Cleaning Technical Debt Adding BehaviorPreparing Removing to Add DuplicationBehavior
  14. 14. Cleaning Technical Debt Adding BehaviorPreparing Removing to Add DuplicationBehavior
  15. 15. Cleaning Technical Debt Adding Behavior Preparing Removing to Add Duplication Behavior r e f ac t o r i ngP
  16. 16. Cleaning Technical Debt Adding Behavior Preparing Removing to Add Duplication Behavior o r i ng Re f ac tPre f ac t o r i ng
  17. 17. R e mo d e li ng Cleaning Technical Debt Adding Behavior Preparing Removing to Add Duplication Behavior o r i ng Re f ac tPre f ac t o r i ng
  18. 18. R e mo d e li ng Cleaning Technical Debt Coding Adding Behavior Preparing Removing to Add Duplication Behavior o r i ng Re f ac tPre f ac t o r i ng
  19. 19. http://www.flickr.com/photos/marcwathieu/4074508950
  20. 20. Tools Strategies Approaches http://www.flickr.com/photos/marcwathieu/4074508950
  21. 21. http://www.flickr.com/photos/pitel/1406292257
  22. 22. http://www.flickr.com/photos/pitel/1406292257
  23. 23. http://www.flickr.com/photos/pitel/1406292257
  24. 24. http://www.flickr.com/photos/pitel/1406292257
  25. 25. http://www.flickr.com/photos/pitel/1406292257
  26. 26. http://www.flickr.com/photos/pitel/1406292257
  27. 27. http://www.flickr.com/photos/pitel/1406292257
  28. 28. http://www.flickr.com/photos/pitel/1406292257
  29. 29. ra te g ie sSt Naked CRC Acceptance Test-Driven Development Test-Driven Development Refactoring Tell the Story Pair ProgrammingSensing Variables Characterization Tests
  30. 30. ra te g ie sSt Naked CRC Acceptance Test-Driven Development Test-Driven Development Refactoring Tell the Story Pair ProgrammingSensing Variables Characterization Tests
  31. 31. ra te g ie sSt Making Changes Acceptance Test-Driven Development Test-Driven Development Refactoring Gaining Understanding Tell the StoryIncreasing Confidence Naked CRCPair ProgrammingCharacterization TestsSensing Variables
  32. 32. Tell the Story Naked CRChttp://www.flickr.com/photos/ransomtech/5811447011
  33. 33. Tell the Story
  34. 34. Naked CRC
  35. 35. Increasing Confidence Sensing VariablesCharacterization Tests Pair Programming http://www.flickr.com/photos/west_point/5863829218
  36. 36. Sensing Variableshttp://www.artima.com/weblogs/viewpost.jsp?thread=170799
  37. 37. Sensing Variableshttp://www.artima.com/weblogs/viewpost.jsp?thread=170799
  38. 38. Sensing Variableshttp://www.artima.com/weblogs/viewpost.jsp?thread=170799
  39. 39. Characterization Testshttp://www.artima.com/weblogs/viewpost.jsp?thread=170799
  40. 40. Characterization Testshttp://www.artima.com/weblogs/viewpost.jsp?thread=170799
  41. 41. Characterization Testshttp://www.artima.com/weblogs/viewpost.jsp?thread=170799
  42. 42. You need to ATDD TDD Refactoring Changhttp://www.flickr.com/photos/slavin_fpo/3728404776
  43. 43. R e mo d e li ng Cleaning Technical Debt Coding Adding Behavior Preparing Removing to Add Duplication Behavior o r i ng Re f ac tPre f ac t o r i ng
  44. 44. R e mo d e li ng Cleaning ATDD Technical Debt Coding Adding Behavior Preparing Removing to Add Duplication Behavior o r i ng Re f ac tPre f ac t o r i ng
  45. 45. R e mo d e li ng Cleaning ATDD Technical TDD Debt Coding Adding Behavior Preparing Removing to Add Duplication Behavior o r i ng Re f ac tPre f ac t o r i ng
  46. 46. R e mo d e li ng Cleaning ATDD Technical TDD Debt Refactoring Coding Adding Behavior Preparing Removing to Add Duplication Behavior o r i ng Re f ac tPre f ac t o r i ng
  47. 47. Example: Acceptance TDD Basic Employee Compensation Each week, hourly employees are paid • A standard wage per hour for the first 40 hours worked • 1.5 times their wage for each hour after the first 40 hours • 2 times their wage for each hour worked on Sundays and holidays
  48. 48. Example: Acceptance TDD Basic Employee Compensation Each week, hourly employees are paid • A standard wage per hour for the first 40 hours worked • 1.5 times their wage for each hour after the first 40 hours • 2 times their wage for each hour worked on Sundays and holidays Payroll.Fixtures.WeeklyCompensation Standard Hol/Sun Wage Pay() Hours Hours 40 0 20 45 0 20 48 8 20
  49. 49. Example: Acceptance TDD Basic Employee Compensation Each week, hourly employees are paid • A standard wage per hour for the first 40 hours worked • 1.5 times their wage for each hour after the first 40 hours • 2 times their wage for each hour worked on Sundays and holidays Payroll.Fixtures.WeeklyCompensation Standard Hol/Sun Wage Pay() Hours Hours 40 0 20 $800 45 0 20 $950 48 8 20 $1520
  50. 50. http://www.fitnesse.org
  51. 51. http://www.fitnesse.org
  52. 52. http://www.fitnesse.org
  53. 53. http://www.fitnesse.org
  54. 54. A test is not a unit test if:- It talks to the database- It communicates across the network- It touches the file system- It cant run at the same time as any of your otherunit tests- You have to do special things to your environment(such as editing config files) to run it.
  55. 55. http://vinkamat.com/2011/tdd-unit-testing-and-benefits/
  56. 56. Redhttp://vinkamat.com/2011/tdd-unit-testing-and-benefits/
  57. 57. RedGreenhttp://vinkamat.com/2011/tdd-unit-testing-and-benefits/
  58. 58. RedGreenRefactorhttp://vinkamat.com/2011/tdd-unit-testing-and-benefits/
  59. 59. (Refactoring is a) disciplined technique forrestructuring an existing body of code, alteringits internal structure without changing itsexternal behavior
  60. 60. Feather’s Approach ATDD Approach Edit and Pray http://www.flickr.com/photos/phluke/62175794
  61. 61. Feather’s Approach
  62. 62. Feather’s ApproachIdentifyChange Points
  63. 63. Feather’s ApproachIdentifyChange PointsFind Test Points
  64. 64. Feather’s ApproachIdentifyChange PointsFind Test Points Break Dependencie s
  65. 65. Feather’s ApproachIdentifyChange Write Points TestsFind Test Points Break Dependencie s
  66. 66. Feather’s ApproachIdentifyChange Write Points TestsFind Test Points Make Changes Break Dependencie s
  67. 67. Feather’s ApproachIdentifyChange Write Points TestsFind Test Points Make Changes Break Dependencie Refactor s
  68. 68. ATDD Approach
  69. 69. Write ATDD ApproachAcceptance Tests
  70. 70. Write ATDD ApproachAcceptance Tests Write Characterization Tests
  71. 71. Write ATDD ApproachAcceptance Tests Write Characterization Tests Implement Behavior
  72. 72. Write ATDD ApproachAcceptance Tests Write Characterization Tests Implement Behavior Get All Tests to Pass
  73. 73. Write ATDD ApproachAcceptance Tests Write Characterization Tests Celebrate! Implement Behavior Get All Tests to Pass
  74. 74. Write ATDD ApproachAcceptance Tests Write Characterization Tests Celebrate! Implement Behavior Get All Tests to Pass
  75. 75. Write ATDD ApproachAcceptance Tests Write Characterization Tests Celebrate! Implement Behavior Get All Tests to Pass
  76. 76. Write ATDD ApproachAcceptance Tests Write Characterization Tests Celebrate! Implement Behavior Get All Tests to Pass
  77. 77. e fe re n ce sRCory Foyfoyc@coryfoy.com@cory_foycory.foy@netobjectives.com http://www.flickr.com/photos/or4n6e/4827075541

×