BCS SPA2015

Software Practice Advancement Conference

SPA Conference session: 100 Baby Steps away from Spaghetti Code

One-line description:A practice session for emerging the design by baby step refactoring
 
Session format: Tutorial [read about the different session types]
 
Abstract:In theory the idea of baby step refactoring in order to keep the code compilable and the tests green is pretty simple.

The practice is much harder. Some less commonly known refactoring techniques are necessary in order to emerge a clean object-oriented design step by step from typical spaghetti code suffering from procedural character, entangled responsibilities and high coupling.

We'll start with a small application that has the domain logic together with user interaction and file IO implemented in a single large method. From there we are going to untangle responsibilities, separate concerns, emerge domain objects and learn refactoring techniques like parallel change, narrow change, loop splitting and duplicate&reduce on the way.

We will end up with seven well focused classes and hopefully can say that the code was never uncompilable for more than a few seconds at once on the way.

And of course, there are tests, that should never become red. ;-)

 
Audience background:Java or C# programmer with basic refactoring skills.
 
Benefits of participating:Cowboy refactoring may be much cooler. But developers who refactor in baby step probably live much longer as they are not shot down by the 100 red tests when the code becomes finally compilable again after hours of refactoring shoot-out.
 
Materials provided:- Exercise in C# and Java
- Step by step solution on GitHub
- A few slides for explanation of the overall concepts
 
Process:Guided coding exercise,
can be done individually or in pairs.
 
Detailed timetable:00:00-00:10 introduction and setup
00:10-02:15 9 exercise sections of
- explaining the next refactoring target
- do it
- step by step demonstration of the way coming from A to B
02:15-02:30 outlook and feedback
 
Outputs:Hopefully compilable code in good design with all tests green. ;-)
 
History:The session was created and held twice already for an internal craftsmanship training at Zuehlke Engineering, Switzerland.
 
Presenters
1. Rick Janda
Zuehlke AG, Switzerland
2. Immo Hüneke
Zuhlke Engineering Ltd
3.