Mikado Method - Beheading the Legacy Beast - Agile India 2012

61
Beheading the legacy beast Refactorings & restructurings with The Mikado Method Daniel Brolund @danielbrolund #mikadomethod @mikadomethod

description

 

Transcript of Mikado Method - Beheading the Legacy Beast - Agile India 2012

Page 1: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Beheading the legacy beast

Refactorings & restructurings with

The Mikado Method

Daniel Brolund @danielbrolund#mikadomethod @mikadomethod

Page 2: Mikado Method - Beheading the Legacy Beast - Agile India 2012
Page 3: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Code change horror stories!!

Page 4: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Once upon a time, we were to change

a codebase...

Page 5: Mikado Method - Beheading the Legacy Beast - Agile India 2012
Page 6: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Lets say this was our system...

Page 7: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

We were to make a change...

Page 8: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

...but we got some errors...

✘ ✘✘

✘✘✘✘

Page 9: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Patching led to more errors...

✘ ✘✘

✘✘✘✘

Page 10: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Patching led to more errors...

✘ ✘✘

✘✘✘✘

✘✘✘✘

Page 11: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Patching led to more errors...

✘ ✘✘

✘✘✘✘

✘✘✘✘

✘✘

✘✘

Page 12: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Patching led to more errors...

✘ ✘✘

✘✘✘✘

✘✘✘✘

✘✘

✘✘

✘✘✘

✘✘ ✘

✘✘

Page 13: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

...and each patch led to even more errors...

✘ ✘✘

✘✘✘✘

✘✘✘✘

✘✘

✘✘

✘✘✘

✘✘ ✘

✘✘

Page 14: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

...and each patch led to even more errors...

✘ ✘✘

✘✘✘✘

✘✘✘✘

✘✘

✘✘

✘✘✘

✘✘ ✘

✘✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

Page 15: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Like trying to stop the shockwave with our hands...

✘ ✘✘

✘✘✘✘

✘✘✘✘

✘✘

✘✘

✘✘✘

✘✘ ✘

✘✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

Page 16: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

✘ ✘✘

✘✘✘✘

✘✘✘✘

✘✘

✘✘

✘✘✘

✘✘ ✘

✘✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

✘✘ ✘

We could only revert.

Page 17: Mikado Method - Beheading the Legacy Beast - Agile India 2012

We could only revert.

Page 18: Mikado Method - Beheading the Legacy Beast - Agile India 2012
Page 19: Mikado Method - Beheading the Legacy Beast - Agile India 2012

But we really needed to do that change!

Page 20: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

The same change...

Page 21: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

...the same errors...

✘ ✘ ✘✘

✘✘✘✘

Page 22: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

This time, we noted a prerequisite for each

of the errors...

✘ ✘ ✘✘

✘✘✘✘

Page 23: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

This time, we noted a prerequisite for each

of the errors...

✘ ✘ ✘✘

✘✘✘✘

Page 24: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

PrereqPrereq

This time, we noted a prerequisite for each

of the errors...

✘ ✘ ✘✘

✘✘✘✘

Page 25: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

This time, we noted a prerequisite for each

of the errors...

✘ ✘ ✘✘

✘✘✘✘

Page 26: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

...then we reverted the errors,

but we kept the notes!

Page 27: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

PrereqThen we implemented the

prerequisites, one at a time...

Page 28: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

PrereqThen we implemented the

prerequisites, one at a time...

Page 29: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

...got newerrors...

✘✘✘✘

✘✘✘✘

Page 30: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

...noted the new prerequisites...

✘✘✘✘

✘✘✘✘

Page 31: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

Prereq

...noted the new prerequisites...

✘✘✘✘

✘✘✘✘

Page 32: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

Prereq

Prereq

...noted the new prerequisites...

✘✘✘✘

✘✘✘✘

Page 33: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

Prereq

Prereq

✘✘✘✘

✘✘✘✘

...and reverted

again

Page 34: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

Prereq

Prereq

...and reverted

again

Page 35: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

Prereq

Prereq

Picked thenext leaf a.s.o...

Page 36: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

Prereq

Prereq

...until we could do a prerequisite w/o

errors

Page 37: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

Prereq

Prereq

✔✔

We continued with all leaves...

Page 38: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

Prereq

Prereq

✔✔

...getting transient prerequisites in place...

Page 39: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

Prereq

Prereq

✔✔

✔ ✔ ...fulfilling prerequisites...

Page 40: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

Prereq

Prereq

✔✔

...working the way back to the

original change

Page 41: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

Prereq

Prereq

In time, all prerequisites for the original change

were in place...

✔✔

Page 42: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

Prereq

Prereq

✔✔

The change was now easy to implement.

Page 43: Mikado Method - Beheading the Legacy Beast - Agile India 2012

A change

Prereq

Prereq

Prereq

Prereq

Prereq

✔✔

We’re done!

Page 44: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Mikado Method“rules”

Page 45: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Mikado Method“rules”

Write down your goal

Page 46: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Mikado Method“rules”

Seek things to tryWrite down your goal

Page 47: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Mikado Method“rules”

Seek things to tryBack out broken code

Write down your goal

Page 48: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Mikado Method“rules”

Seek things to tryBack out broken code

Fix the prerequisites recursively

Write down your goal

Page 49: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Benefits

Page 50: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Benefits

Always deliverable - from the main branch

Page 51: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Benefits

Always deliverable - from the main branch

Goal focus - do only the necessary

Page 52: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Benefits

Always deliverable - from the main branch

Goal focus - do only the necessary

Visualization - memo and cooperation

Page 53: Mikado Method - Beheading the Legacy Beast - Agile India 2012

The Mikado Method?!?

Page 54: Mikado Method - Beheading the Legacy Beast - Agile India 2012

The Mikado Method?!?

Page 55: Mikado Method - Beheading the Legacy Beast - Agile India 2012
Page 56: Mikado Method - Beheading the Legacy Beast - Agile India 2012

?!?Now, where’s the code...?!?

Page 57: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Let's do an example!

Page 58: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Welcome to Pasta Inc.

Page 59: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Exercise: D.I.Y.Instructions:http://mikadomethod.wordpress.com/exercises/

Code:https://github.com/mikadomethod/kata-java

Git:git clone git://github.com/mikadomethod/kata-java.git

git clone git://github.com/mikadomethod/kata-dotnet.git

Page 60: Mikado Method - Beheading the Legacy Beast - Agile India 2012

The bookDaniel Brolund @danielbrolundOla Ellnestam @ellnestam#mikadomethod @mikadomethod

http://mikadomethod.orghttp://mikadomethod.wordpress.com/bookhttp://groups.google.com/group/mikado-method Daniel Brolund

Ola Ellnestam

Beheading the Legacy Beast

Relentless restructurings with

The Mikado Method

Foreword by Tom Poppendieck

Page 61: Mikado Method - Beheading the Legacy Beast - Agile India 2012

Questions?

...or catch me later!

???