Code Smells -> Refactoring -> Unit Tests

Striped Skunk - Mephitis mephitis 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 Sea of Complexitywould 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:

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.

Be Sociable, Share!

Certified ScrumMaster TrainingIf you enjoyed this post take a look at Certified ScrumMaster Training. We currently have courses scheduled in Ottawa, Montreal, Toronto and Edmonton.


  • http://www.sandywalsh.com Sandy

    Haha … I was at Microsoft Tech Days for the last two days. One of the presentations was on SOLID for ASP MVC. It’s been years since I looked at SOLID and I realized I largely don’t agree with it. The SOLI rules conflict and it essentially boils down to D, which can be paraphrased as “use a dependency injection container for all API classes”. Don’t even get me started on Dependency Injection which is just a bastardization of the proper Gang of Four ‘Strategy’ pattern.

    But, blanket DI itself is wrong, of course, because it violates a higher priority idiom than SOLID, which is YAGNI and ends up creating GOD classes all over the place.

    Left me feeling sad and a little dirty.

  • Ian Sinaga18

    hey, i don’t know how to test the result of the refactoring that i have done. i am using visual studio and jetbrains reharper