Two weeks ago I gave an introductory tutorial on “From Code Smells to Unit Tests” (pdf) at Agile Tour Toronto (thanks to the organizers for a great conference). The slides presented an introduction to Technical Debt, SOLID Principles, The Sea of Complexity, Basic Code Smells, Refactoring and Unit Testing Basics, and Good Practices, Bad Practices. As usual, the slides were only taste of what was said. In the session, two elements didn’t work: First, I wasn’t expecting to have to explain SOLID Principles—I was caught off guard and was ill prepared. Second, the pair Refactoring Demo tanked. The plan was to invite audience members up to refactor Martin Fowler’s Movie Example (git hub browseable, zip file) and then they
would make small improvements five minutes at a time.The goal was to help people integrate what we had already covered in the seminar by doing it live. There has to be another way of providing an integration event. Basically, I would need to give the audience a way for experiencing refactoring for themselves.
Please try the Movie Example (git hub browseable, zip file) and see how far you can get with some simple refactorings.
References:
- The Art of Unit Testing: with Examples in .NET (Amazon.ca) – Roy Osherove (.NET and soon a Java version)
- Refactoring: Improving the Design of Existing Code (Amazon.ca) – Martin Fowler
- Refactoring to Patterns (Amazon.ca) – Joshua Kerievsky
- xUnit Test Patterns: Refactoring Test Code (Amazon.ca) – Gerard Meszaros
- Pragmatic Unit Testing in C# with NUnit(Amazon.ca) – Andy Hunt and Dave Thomas
- Pragmatic Unit Testing in Java with JUnit (Amazon.ca) – Andy Hunt and Dave Thomas
BTW David Koontz did the hard work of typing in Martin Fowler’s Movie sample – I just modernized it (Java 1.2 –> 1.6).
Caveat Emptor – if you buy any of the books after clicking on my link I get 4% of the price. In all likelihood that means I might be able to afford a coffee or two.




