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

Kev McCabe - Mikado Method - Making Code Change...

Lean Agile Scotland
October 26, 2012
870

Kev McCabe - Mikado Method - Making Code Changes Less of an Impact

The Mikado Method is a simple straight forward methodology for large scale refactoring. We’ve all been there; tasked with a change, which as optimistic developers we say won’t take us long, weeks later we’re still fighting the system. Enter the Mikado Method, a way to peel the layers of complexity away from any system. Systematically attack refactoring, in the knowledge that every change you make will be for the better of the system, rather than hoping it will be. When it comes to refactoring legacy systems, sometimes it faster just to get in there and naively attempt to make the change required rather than speed weeks analysing the affects. Naively making the change will always have knock on affects to other parts of the system. It is these knock on affects that cause what we believe to be quick changes to become large, long drawn out changes. With the Mikado Method, your system will always be runnable while you refactor, say goodbye to the feature branches of refactoring, and hello to a runnable testable system all the time. Fix one issue at a time, and keep your system deliverable at all times. The method also works when it comes to implementing new features or fixing bugs in a system, there are always side effects when we need to change code. The Mikado Method will help in all these situations. In a nut shell, it's Red, Green, Refactor on a large scale. A way to safely start paying back your technical debt.

Lean Agile Scotland

October 26, 2012
Tweet

Transcript

  1. The Mikado Method Kev McCabe Friday, October 26, 2012 35

    Minutes Presentation 10 Minutes Chat
  2. About me • Lead Developer @GE • Developer For over

    15 Years • Adobe Community Professional • Adobe User Group Manager • Avid London Irish Fan
  3. What we’ve all had to deal with Legacy Code •

    Add this functionality • Fix this bug • Make this improvement
  4. Implement a change Change X X X X X X

    X X X X X X X X X X X X X X X X X
  5. OR • Legacy Code & Endless Bugs makes developers something

    something • Go Crazy? • Don’t Mind If We Do
  6. The Goal: Morphing a system If we want to be

    successful software developers, we need to learn how to morph an existing system to a desired new shape.
  7. Implement the same change Change X X X X X

    X X X X X Same Errors, this time we note them
  8. Implement the same change Change X X X X X

    X X X X X We roll back code & work on the Errors 1 at a time
  9. Implement the same change Change X X X X X

    X X X X X X X X X X X We find more errors & fix them as we go, roll back when we need
  10. Implement the same change Change X X X X X

    X X X X X X X X X X X As we fix the leafs we move inwards & outwards to other leaves X X
  11. Implement the same change Change X X X X X

    X X X X X X X X X X X We always roll back to the last working version of the code when we find an error X X
  12. Implement the same change Change X X X X X

    X X X X X X X X X X X We may find some leafs block others X X
  13. Implement the same change Change X X X X X

    X X X X X X X X X X X As we fix the leafs we move inwards & outwards to other leaves X X
  14. Implement the same change Change X X X X X

    X X X X X X X X X X X As we fix the leaves we move inwards & outwards to other leaves X X
  15. Implement the same change Change X X X X X

    X X X X X X X X X X X As we fix the leaves we move inwards & outwards to other leaves X X
  16. The Mikado method flow Start Here Draw the Mikado goal

    Implement the goal naively Select the next prerequisite to work on Revert the changes Come up with immediate solution Draw solutions as prerequisites Check in Done! Is the Mikado goal met? Does a commit make sense? Are there any errors? No No No Yes Yes Yes
  17. Mikado Method “rules” Write down your goal Seek things to

    try - note where it breaks Back out broken code - it’s broken! Fix the leafs– recursively
  18. Benefits Always deliverable - from the main branch Goal focus

    - do only the necessary Visualize - memo and cooperation
  19. Mikado: • Fits nicely in an incremental process • Increases

    visibility of the work • Supports continuous deployments by finding a non-destructive change path • Enhances learning • Scales by enabling distribution of the workload over the team • Is easy to use
  20. Before we start • Back out broken code • Make

    sure everything is working as expected • Maybe label in SCM the start of the refactor • What’s our goal?
  21. Create New Client project deliverable for New Client Create acceptance

    test for new application Put UI code in separate project
  22. Create New Client project deliverable for New Client Create acceptance

    test for new application Put UI code in separate project Put UI code in separate project Create New Client project
  23. Create New Client project deliverable for New Client Create acceptance

    test for new application Put UI code in separate project Put UI code in separate project Create New Client project Break circular dependency between UI and Application
  24. Create New Client project deliverable for New Client Create acceptance

    test for new application Put UI code in separate project Put UI code in separate project Create New Client project Break circular dependency between UI and Application Extract ApplicationInterface
  25. Create New Client project deliverable for New Client Create acceptance

    test for new application Put UI code in separate project Put UI code in separate project Create New Client project Break circular dependency between UI and Application Extract ApplicationInterface Inject instance of ApplicationInterface
  26. Create New Client project deliverable for New Client Create acceptance

    test for new application Put UI code in separate project Put UI code in separate project Create New Client project Break circular dependency between UI and Application Extract ApplicationInterface Inject instance of ApplicationInterface
  27. Create New Client project deliverable for New Client Create acceptance

    test for new application Put UI code in separate project Put UI code in separate project Create New Client project Break circular dependency between UI and Application Extract ApplicationInterface Inject instance of ApplicationInterface
  28. Create New Client project deliverable for New Client Create acceptance

    test for new application Put UI code in separate project Put UI code in separate project Create New Client project Break circular dependency between UI and Application Extract ApplicationInterface Inject instance of ApplicationInterface
  29. More info • Grab the eBook from – http://mikadomethod.org/ –

    The Use case used is from chapter 2 • Code is available to work with on Git Hub • Public Articles – http://www.infoq.com/news/ 2012/02/mikado-method – http://java.dzone.com/article s/mikado-method