Todd Fast's Blog
Dependency injection vs. service locator
This article by Martin Fowler describes the dependency injection and service locator patterns and offers some pros and cons of each.
As interesting and useful as dependency injection and inversion of control (IoC) containers are, I tend to agree with Martin's conclusion that the service locator is a somewhat more straightforward pattern, especially if a standard locator mechanism like JNDI is available. On the flip side, as developers become more and more accustomed to dependency injection, particularly as a primary idiom for application development, it does offer some interesting opportunities to (at least seemingly) reduce application complexity.
--
Posted at 12:52AM Nov 18, 2004
by Todd Fast in Web |
Comments[1]
Tags: /
Like this post?
|
|
|
|
Posted by Unknown on November 18, 2004 at 03:22 AM PST #