As the disucussion progressed, it became more clear to me that there really is no significant difference in how Dependency Injection containers and Service Locator containers are written. They are both Inversion of Control (IOC) containers, and are not distinguishable by their code, API, features, etc. (although some may have more or fewer features than others).
As such, the terms Dependency Injection and Service Locator appear to be interchangeable in the sense that a container is a container is a container. The difference in naming comes from how the container is used, not how the container is implemented.
He suggests that one of the main differences is where they are, either inside or outside of a non-Factory object. He circles back around to the names, though, and points out that when developers talk to one another, they need to be speaking the same language. As such, he tries to set this vocabulary for the implementations, separati
Link: http://paul-m-jones.com/archives/5853
没有评论:
发表评论