Archive

Archive for the ‘Dependency Injection’ Category

Bend Over; This won't Hurt a Bit: ActionScript 3.0 Dependency Injection.

October 13, 2010 45 comments

It's Time for Your Dependency Injection!

It's Time for Your Dependency Injection!

When I hear “dependency” and “design patterns” in the same sentence it usually means the latter is at work reducing the former. However, in the case of dependency injection, it is an important part of both design patterns and unit testing. Chandima has mentioned it in a discussion of the Iterator pattern, I’ve a post on the dependency inversion principle, which is a close cousin. However, the concept of dependency injection is one which could use a post that focuses on it and not the different patterns that may use it. So here goes.

The go-to guy in dependency injection is Martin Fowler, but I first became aware of it in one of Miško Hevery’s posts, and it was the topic of his discussion at last year’s OOPSLA meetings in Orlando, Florida. In looking around for different takes on dependency injection (or DI as all the cool kids call it), one of the better ones was by Griffin Caprio on an MSDN page. Caprio uses a Factory example, but alas, it’s an Abstract Factory, and I get the heebie-jeebies just looking at the class diagram. So explaining DI using an Abstract Factory is like explaining simple arithmetic using quantum physics. (Just clench your teeth and click the link to get the rest.)
Read more…

Share
Categories: Dependency Injection