m k
play

M K Using Japanese to save your I a Legacy S/W k n + a b d - PowerPoint PPT Presentation

M K Using Japanese to save your I a Legacy S/W k n + a b d a o n Mikado Method Mikado Game Making a change to your legacy code is not unlike picking out the Mikado from the other sticks in the pile. Removing one impacts the


  1. M K Using Japanese to save your I a Legacy S/W k n + a b d a o n

  2. Mikado Method  Mikado Game Making a change to your legacy code is not unlike picking out the Mikado from the other sticks in the pile. Removing one impacts the others. And not in a good way… What is the biggest difference?

  3. We can Revert our code!

  4. The Guts of the Mikado Method • Make the ONE change you need/want to make • See what broke – these are pre-requisites (the next set of changes to make before doing this one) • Visualize (add to graph) • REVERT !! Repeat until no breakages occur.

  5. Change Move Move ฀ ฀ ฀ ฀ Reimplement Check User Deployment Publish-Reject DB Interface Permissions Properties Code Separate Separate ฀ ฀ Approval Storage Logic Interface D i s c o v e r y R e f a c t o r Create Remove ฀ ฀ Standalone Methods from Publish Edit Server Server Code Decouple ฀ Content Edit & Publishing Servers

  6. For Defects… • Need to use exploratory and regression testing to ID the next items to be graphed • If not present, wrap unit tests around what you are touching • Have testing occur in an environment that mimics as close to production as possible

  7. Real Mikado Power • Comes when you have unit, integration , and acceptance tests • These help reveal necessary refactors by showing failures that the change creates • Safer than exploration to find breakages

  8. Some Restructuring Considerations • Refactor Before Adding Functionality • Separate Bulky Interfaces (limiting the consumers it serves) • Extract Methods/Classes into Common Libraries Let’s look at the first one…

  9. Refactor Before Adding Functionality • Suppose - . . . public static final int FIVE_CARD_POKER = 0; public static final int INDIAN_POKER = 1; . . . Public class CardGameEngine { . . . public void deal (Game game, User user, Dealer dealer) { if (game.getType() == FIVE_CARD_POKER { user.setCards(dealer.deal(5)); } else if (game.getType() == INDIAN_POKER { user.setCards(dealer.deal(1)); } else { // else what? } } • Want to add War (each player is dealt 26 cards) • Could add it to the If-Then-Else logic, but this will get messy, especially if I wanted to add more…

  10. Mikado Graph for Refactor Move 5 Card Poker Move Indian Poker Logic to FiveCardPoker Logic to IndianPoker class class Refactor Implement War If statements to extract Logic to War class game-specific logic Add War card game

  11. Update Intake Triage Ready Tests FIX Re-Test Deploy DONE Done Done Done ฀ ฀

  12. T Y あ り H O が A U と う N ご K ざ い ま し た

Recommend


More recommend