This post originated from an RSS feed registered with Java Buzz
by dion.
Original Post: Dependency Injection as an Assembly line pattern
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Scott Ferguson of Caucho (Resin) likes to think of IoC as an assembly pattern, and this makes the choice of constructor-based versus setter-based versus getter-based small fry... in the implementation... as apposed to the big picture.
Working through some dependency injection documentation, I'm finding it better to think of the IoC/DI pattern as an "Assembly Line" pattern.
As an Assembly Line pattern, the setter vs constructor issue looks like choosing between metric and British measurement or Phillips vs flat screws. The choice does matter, but it's a minor decision compared to choosing IoC/DI in the first place.
The point of the Assembly Line pattern is that the Parts and Chassis are decoupled from the choice of Assembler. The parts need to conform to some rules: like Phillips screws, but otherwise it's straightforward to switch Assemblers from a container to a test suite.
Resin IoC Tutorial: Dependency Injection for Resources