SPA Conference session: Replacing Conditionals with Polymorphism

One-line description:An exercise in replacing hair-raising conditionals with simple objects, of necessity discussing simplicity, abstractions, and DRYness along the way.
 
Session format: 150 minute workshop [read about the different session types]
 
Abstract:Conditionals are the bane of object-oriented programming. Many times they are initially the cheapest solution but as time passes they attract friends and gradually become impossible to understand, test, reuse, or change. This workshop uses the song (99 Bottles of Beer)[http://en.wikipedia.org/wiki/99_Bottles_of_ Beer] as the basis for a group refactoring which gradually replaces conditionals with simple objects. It develops a refactoring recipe that breaks the process into iterative steps. Each step ends with working code (a "landing point") and while every intermediate landing point is more complicated than the initial solution, the final result is markedly simpler. Participants will learn to confidently remove conditionals. They'll see temporary complexity pay off in ultimate simplicity and learn about the perils of abstraction and the tyranny of DRY. They'll sing while they do this, and afterwards will likely want a beer.
 
Audience background:The refactoring is in Ruby; enjoying the session requires an interest in object-oriented programming.
 
Benefits of participating:Participants will learn straightforward strategies to simplify object-oriented code (in a musical environment).
 
Materials provided: An example test suite on Github.
 
Process:This works best if participants do the refactoring themselves, which obviously requires that they know and are set up to run Ruby on their laptops. Depending on the makeup of the class we'll use combination of pairing, small groups, and mob programming to do the exercise.

If you do not have Ruby installed you'll likely be able to pair with someone who does. If you wish to install Ruby, follow (these instructions)[http://bit.ly/1ncVLL2].
 
Detailed timetable:Really?
 
Outputs: A new way to think about objects.
 
History:I have not presented this at a conference but I do this refactoring in private and public OOP training courses. When I teach this in class the exercise takes significantly longer than 150 minutes, but I have hopes that a combination of a more experienced audience and instructor nudging can get us through. :-)
 
Presenters
1. Sandi Metz
Independent
2. Matt Wynne
Cucumber Limited
3.