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.

Related posts:

  1. Best Agile Books 2007 Development/Code Related
  2. Unit Testing in JavaScript
  3. Test Driven Development vs "Plain Old Unit Testing"
  4. Developing Eclipse RCP apps? Want access to Display etc will running your Unit Tests
  5. Online Code Reviews suck – even Guido van Rossum can’t fix that
TwitterFacebook Google Plus Stumbleupon Delicious Reddit Email

About

ScrumMaster Trainer

One Comment

  1. Sandy November 3, 2009 at 5:40 pm #

    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.

Post Comment