1. Reclaim your legacy
systems
Toe-dipping and deep-diving with
The Mikado Method
Daniel Brolund @danielbrolund
Ola Ellnestam @ellnestam
#mikadomethod @mikadomethod
http://mikadomethod.wordpress.com/book
Thursday, March 17, 2011
2. 2-by-2 sharing:
Code-change horror stories
Thursday, March 17, 2011
3. Once upon a time,
we were to change
a codebase...
Thursday, March 17, 2011
44. Mikado Method
“rules”
Write down your goal -code or business
Thursday, March 17, 2011
45. Mikado Method
“rules”
Write down your goal -code or business
Seek things to try - note where it breaks
Thursday, March 17, 2011
46. Mikado Method
“rules”
Write down your goal -code or business
Seek things to try - note where it breaks
Back out of broken code - it’s broken
Thursday, March 17, 2011
47. Mikado Method
“rules”
Write down your goal -code or business
Seek things to try - note where it breaks
Back out of broken code - it’s broken
Fix the prerequisites - recursively
Thursday, March 17, 2011
59. Questions?
Is this instead of refactorings
or WELC?
What about dynamically typed languages?
How do I get started?
What about design principles?
Thursday, March 17, 2011
60. Forces
when refactoring?
Thursday, March 17, 2011
61. Forces
when refactoring?
http://commons.wikimedia.org/wiki/File:Maglev_june2005.jpg
Thursday, March 17, 2011
62. Design principles!
Move towards systems that are stable
in the face of change
Thursday, March 17, 2011
63. A selection of
software principles
Thursday, March 17, 2011
64. A selection of
software principles
• Don’t Repeat Yourself
Thursday, March 17, 2011
65. A selection of
software principles
• Don’t Repeat Yourself
• Class design principles
Thursday, March 17, 2011
66. A selection of
software principles
• Don’t Repeat Yourself
• Class design principles
• Low coupling, high cohesion
Thursday, March 17, 2011
67. A selection of
software principles
• Don’t Repeat Yourself
• Class design principles
• Low coupling, high cohesion
• Immutability
Thursday, March 17, 2011
68. A selection of
software principles
• Don’t Repeat Yourself
• Class design principles
• Low coupling, high cohesion
• Immutability
• Pure functions
Thursday, March 17, 2011
100. Thursday, March 17, 2011
Cohesion
http://www.freedigitalphotos.net/images/view_photog.php?photogid=1970
101. Cohesion
The Release Reuse Equivalency Principle - REP
"The granule of release is the granule of reuse."
http://www.freedigitalphotos.net/images/view_photog.php?photogid=1970
Thursday, March 17, 2011
102. Cohesion
The Release Reuse Equivalency Principle - REP
"The granule of release is the granule of reuse."
The Common Reuse Principle - CRP
"Classes that are used together are packaged together."
http://www.freedigitalphotos.net/images/view_photog.php?photogid=1970
Thursday, March 17, 2011
103. Cohesion
The Release Reuse Equivalency Principle - REP
"The granule of release is the granule of reuse."
The Common Reuse Principle - CRP
"Classes that are used together are packaged together."
The Common Closure Principle - CCP
http://www.freedigitalphotos.net/images/view_photog.php?photogid=1970
"Classes that change together are packaged together."
Thursday, March 17, 2011
104. Cohesion
The Release Reuse Equivalency Principle - REP
"The granule of release is the granule of reuse."
The Common Reuse Principle - CRP
"Classes that are used together are packaged together."
The Common Closure Principle - CCP
http://www.freedigitalphotos.net/images/view_photog.php?photogid=1970
"Classes that change together are packaged together."
Thursday, March 17, 2011
106. Coupling
The Acyclic Dependencies Principle - ADP
"The dependency graph of packages must have no cycles."
Thursday, March 17, 2011
107. Coupling 142 Principles of packages
Pkg Pkg
The Acyclic Dependencies Principle - ADP
"The dependency graph of packages must have no cycles." Pkg Pkg
Pkg
Figure 6.13: Cyclic dependencies are evil
142
Thursday, March 17, 2011
108. Coupling 142 Principles of packages
Pkg Pkg
The Acyclic Dependencies Principle - ADP
"The dependency graph of packages must have no cycles." Pkg Pkg
Pkg
Figure 6.13: Cyclic dependencies are evil
The Stable Dependencies Principle - SDP
"Depend in the direction of stability." 142
Thursday, March 17, 2011
109. Coupling 142 Principles of packages
Pkg Pkg
The Acyclic Dependencies Principle - ADP
"The dependency graph of packages must have no cycles." Pkg Pkg
Pkg
Figure 6.13: Cyclic dependencies are evil
The Stable Dependencies Principle - SDP
"Depend in the direction of stability." 142
Thursday, March 17, 2011
110. Coupling 142 Principles of packages
Pkg Pkg
The Acyclic Dependencies Principle - ADP
"The dependency graph of packages must have no cycles." Pkg Pkg
Pkg
Figure 6.13: Cyclic dependencies are evil
The Stable Dependencies Principle - SDP
"Depend in the direction of stability." 142
The Stable Abstractions Principle - SAP
"Abstractness increases with stability."
Thursday, March 17, 2011
111. Coupling 142 Principles of packages
Pkg Pkg
The Acyclic Dependencies Principle - ADP
"The dependency graph of packages must have no cycles." Pkg Pkg
Pkg
Figure 6.13: Cyclic dependencies are evil
The Stable Dependencies Principle - SDP
"Depend in the direction of stability." 142
The Stable Abstractions Principle - SAP
"Abstractness increases with stability."
Map of Old Town in Stockholm, 1733
Thursday, March 17, 2011
116. Coding: Exercise 2
Instructions:
http://mikadomethod.wordpress.com/exercises/
Thursday, March 17, 2011
117. Coding: Exercise 2
Instructions:
http://mikadomethod.wordpress.com/exercises/
Easy
Enable reuse of PhysicalObject
Thursday, March 17, 2011
118. Coding: Exercise 2
Instructions:
http://mikadomethod.wordpress.com/exercises/
Easy Intermediate
Two separate,
minimal, deliverables for
Enable reuse of PhysicalObject
bouncing balls and solar
system.
Thursday, March 17, 2011
119. Coding: Exercise 2
Instructions:
http://mikadomethod.wordpress.com/exercises/
Easy Intermediate Difficult
Two separate,
The domain logic is
minimal, deliverables for
Enable reuse of PhysicalObject compilable without Swing/AWT
bouncing balls and solar
dependencies
system.
Thursday, March 17, 2011
122. Create physics
project
Enable reuse of
PhysicalObject
Thursday, March 17, 2011
123. Move
Create physics PhysicalObject to physics
project projects
Enable reuse of
PhysicalObject
Thursday, March 17, 2011
124. Make space
depend on physics
projects
Move
Create physics PhysicalObject to physics
project projects
Enable reuse of
PhysicalObject
Thursday, March 17, 2011
125. Pass stepSize
(Space.seconds) to hitBy(..)
Make space
depend on physics
projects
Move
Create physics PhysicalObject to physics
project projects
Enable reuse of
PhysicalObject
Thursday, March 17, 2011
126. Move PaintPhysicalObject to
new SpaceGraphics class
Pass stepSize
(Space.seconds) to hitBy(..)
Make space
depend on physics
projects
Move
Create physics PhysicalObject to physics
project projects
Enable reuse of
PhysicalObject
Thursday, March 17, 2011
127. Create
SpaceGraphics class
Move PaintPhysicalObject to
new SpaceGraphics class
Pass stepSize
(Space.seconds) to hitBy(..)
Make space
depend on physics
projects
Move
Create physics PhysicalObject to physics
project projects
Enable reuse of
PhysicalObject
Thursday, March 17, 2011
128. Create Inject PhysicalObject po
SpaceGraphics class into PaintPhysicalObject
Move PaintPhysicalObject to
new SpaceGraphics class
Pass stepSize
(Space.seconds) to hitBy(..)
Make space
depend on physics
projects
Move
Create physics PhysicalObject to physics
project projects
Enable reuse of
PhysicalObject
Thursday, March 17, 2011
129. Create
✔
Inject PhysicalObject po
SpaceGraphics class into PaintPhysicalObject
Move PaintPhysicalObject to
new SpaceGraphics class
Pass stepSize
(Space.seconds) to hitBy(..)
Make space
depend on physics
projects
Move
Create physics PhysicalObject to physics
project projects
Enable reuse of
PhysicalObject
Thursday, March 17, 2011
130. Create ✔ ✔
Inject PhysicalObject po
SpaceGraphics class into PaintPhysicalObject
Move PaintPhysicalObject to
new SpaceGraphics class
Pass stepSize
(Space.seconds) to hitBy(..)
Make space
depend on physics
projects
Move
Create physics PhysicalObject to physics
project projects
Enable reuse of
PhysicalObject
Thursday, March 17, 2011
131. Create ✔ ✔
Inject PhysicalObject po
SpaceGraphics class into PaintPhysicalObject
Move PaintPhysicalObject to
new SpaceGraphics class
✔
Pass stepSize
(Space.seconds) to hitBy(..)
Make space
depend on physics
projects
Move
Create physics PhysicalObject to physics
project projects
Enable reuse of
PhysicalObject
Thursday, March 17, 2011
132. Create ✔ ✔
Inject PhysicalObject po
SpaceGraphics class into PaintPhysicalObject
Move PaintPhysicalObject to
new SpaceGraphics class
✔
Pass stepSize ✔
(Space.seconds) to hitBy(..)
Make space
depend on physics
projects
Move
Create physics PhysicalObject to physics
project projects
Enable reuse of
PhysicalObject
Thursday, March 17, 2011
133. Create ✔ ✔
Inject PhysicalObject po
SpaceGraphics class into PaintPhysicalObject
Move PaintPhysicalObject to
new SpaceGraphics class
✔
Pass stepSize ✔
(Space.seconds) to hitBy(..)
Make space
depend on physics
projects
Move
Create physics
project
✔ PhysicalObject to physics
projects
Enable reuse of
PhysicalObject
Thursday, March 17, 2011
134. Create ✔ ✔
Inject PhysicalObject po
SpaceGraphics class into PaintPhysicalObject
Move PaintPhysicalObject to
new SpaceGraphics class
✔
Pass stepSize ✔
(Space.seconds) to hitBy(..)
Make space
depend on physics
✔
projects
Move
Create physics
project
✔ PhysicalObject to physics
projects
Enable reuse of
PhysicalObject
Thursday, March 17, 2011
135. Create ✔ ✔
Inject PhysicalObject po
SpaceGraphics class into PaintPhysicalObject
Move PaintPhysicalObject to
new SpaceGraphics class
✔
Pass stepSize ✔
(Space.seconds) to hitBy(..)
Make space
depend on physics
✔
projects
Move ✔
Create physics
project
✔ PhysicalObject to physics
projects
Enable reuse of
PhysicalObject
Thursday, March 17, 2011
136. Create ✔ ✔
Inject PhysicalObject po
SpaceGraphics class into PaintPhysicalObject
Move PaintPhysicalObject to
new SpaceGraphics class
✔
Pass stepSize ✔
(Space.seconds) to hitBy(..)
Make space
depend on physics
✔
projects
Move ✔
Create physics
project
✔ PhysicalObject to physics
projects
Enable reuse of
PhysicalObject ✔
Thursday, March 17, 2011
137. Thanks!!
Daniel Brolund @danielbrolund
Ola Ellnestam @ellnestam
#mikadomethod @mikadomethod
http://mikadomethod.org
http://mikadomethod.wordpress.com
http://groups.google.com/group/mikado-method
Thursday, March 17, 2011