Yesterday I presented at the first ever FalafelCon conference in Mountain View, California. My session Refactoring with SOLID Principles is now available on SlideShare. I was a little pressed for time, so I had to cover some of the material quickly. For more information, I encourage you to check out my SOLID Principles of Object Oriented Design course. There were a couple of questions from the audience about regions and XML comments, and I’ve written previously about my thoughts on these (Regional Differences, When to Comment Your Code). If you’re looking for the simple demo site I showed along with the presentation, you can find my Guest Book application here. In it I demonstrate how to test an application that uses infrastructure, like sending emails, without having to actually send emails or set up a fake email server (like smtp4dev, which is a great tool, but not for automated unit tests).
Another question I had after this particular talk was, had I comingled the Dependency Inversion Principle with Dependency Injection? I’m sure I must have, to some extent, since I see them as closely related. The DI principle can be used as the basis for reversing dependencies; then dependency injection, which I usually do by following the Strategy design pattern, can be used to allow the formerly tightly coupled code to work in a loosely coupled fashion. Check out the Strategy Design Pattern in the Pattern Library on Pluralsight to learn more.
I’m currently working on a Refactoring Fundamentals course for Pluralsight, which will go into more detail on the specific steps to take to refactor code, as well as covering a wide range of code smells that may be indicators that refactoring is warranted. Look for it to be published in summer 2013.