PabloTV: Eliminating static dependencies screencast

Nature abhors a vacuum.  It turns out she also abhors static dependencies (I have my sources).  Static dependencies are the modern-day globals, often exposed through classes named “Helper”.  I’ve certainly been guilty of overusing static dependencies in the past, with classes like “LoggingHelper”, “SessionHelper”, “DBHelper” and so on.

The problem with static dependencies is that they are opaque to the extreme, enforcing a strong coupling that is impossible to see from users of the class.  To demonstrate techniques for eliminating static dependencies, Ray Houston and I created a short screencast:

Eliminating static dependencies screencast

Our screencast demonstrates using TDD along with ideas and techniques laid out in Michael Feathers’ Working Effectively with Legacy Code and Joshua Kerievsky’s Refactoring to Patterns.  It details how to make safe, responsible changes to an existing legacy codebase, while improving the design by breaking out dependencies to a static class.

Hope you enjoy it!

Related Articles:

Post Footer automatically generated by Add Post Footer Plugin for wordpress.

About Jimmy Bogard

I'm a technical architect with Headspring in Austin, TX. I focus on DDD, distributed systems, and any other acronym-centric design/architecture/methodology. I created AutoMapper and am a co-author of the ASP.NET MVC in Action books.
This entry was posted in BDD, Legacy Code, PabloTV, Refactoring, TDD. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Neil Gibbons

    Great stuff!
    As a developer keen to improve how I wrote code, actually seeing the theory put into action is a great help.

    More I say … more!

    P.S.
    Is that case statement a candidate for a Strategy pattern?

  • http://www.blogcoward.com jdn

    Nicely done. Very useful.

  • http://schambers.lostechies.com Sean Chambers

    Bravo!

    Well done gentlemen. This motivates me to do one next time. After my honeymoon I will see about doing a screencast. I do them for guys here in the office when dealing with training them on various pieces of software so I would like to try one for lostechies.

    good job again!

  • http://chadmyers.lostechies.com Chad Myers

    Great job guys! Thanks for the time and effort involved in this. I especially like how you kept it short, sweet, and packed with info.

  • http://blogs.dovetailsoftware.com/blogs/kmiller Kevin Miller

    Great job. Thanks for the time and effort it took to put that together. I enjoyed the example project. That code looks familiar somehow.

    I was sitting there drinking Miller Lite and screaming “Hit Ctrl+Alt+V to declare the variable! Dammit , nooo! use F6 to move the class to the outer scope!”

    But then I realized that you were keeping it simple to avoid confusion.

  • http://jimmybogard.lostechies.com Jimmy Bogard

    @Kevin

    ACTUALLY

    You can blame Ray on this one. He uses the “Visual Studio” R# shortcuts, while I use “IntelliJ” R# shortcuts. Like a pilot climbing into a fighter jet only to notice all the controls got moved around.

  • http://davesquared.blogspot.com David

    Great screencast, thanks a lot!

    Related to @Neil’s comment about the strategy pattern, a nice candidate for your next screencast (hope there’s a next one :) ) might be to factor out that switch statement to make it easier to add payment types and payment type logic in future. I’d be keen to see that, especially how you use tests to drive your design decisions.

    Regards,
    David

  • Sean Scally

    This is a great screencast. Thanks for making it.

  • Karl

    Very good screencast! I will present it to my dev-team (10 people) next week. It’s really an eye-opener, even if you have read Michael Feathers Book, it’s always good to see these techniques in practice. I’d like to see more of this stuff, maybe some refactoring to patterns stuff, like introducing strategy objects instead of switch statements, etc…
    Keep on doing this great work. Your site and codebetter are my favorite blogging sites!

  • http://colinjack.blogspot.com/ Colin Jack

    Good stuff.

  • http://richarddingwall.name Richard

    404 – original link seems to have gone down?

  • http://www.lostechies.com/members/bogardj/default.aspx bogardj

    @Richard

    Whoops! We moved servers and I guess some URLs got messed up. Here’s the new link:

    http://pablotv.lostechies.com/

  • tieTYT

    I’d really like to watch this video. But it doesn’t seem to exist :(