| Joe Walnes |
|
|||||||||||||||||
|
|
|
|
||||||||||||||||
|
Inversion of Control and Dependency Injector PatternMartin Fowler has pubished a new article:
CommentsAslak HellesoyThe PicoContainer team has decided to embrace this new pattern name: "Constructor based Dependency Injection". This means that we will update the documentation and get rid of the (now obsolete) "IoC type 3" term. Hani SuleimanSee! I was right all along in my evaluation of thoughtworks employees. Stephan SchmidtHani! Sam NewmanSo IoC was basically a new name for DIP (Dependancy Inversion Principle) now has another new name? Aslak HellesoyDon't underestimate the importance of establishing an unambiguous vocabulary. If the name of the pattern doesn't convey anything meaningful about the principles of the pattern, people are going to have a hard time using it. DEPENDENCY INJECTOR!! :-) Now, what did you want to know about the usage of it? PRShould the setter injection for the spring framework be called metadata injection then? Sam NewmanAslak, you do have a point (actually a point I myself made on my blog a while back but conveniently forgot!). I'm actually a little annoyed because: Anyway, if PicoContainer is now a Constructor based Dependency Injection framework, and Spring a Property/Setter based Dependency Injection framework, is Avalon a Service based Dependency Injection framework? The definitions of the 3 types of IoC frameworks still remain valid if we are talking about Dependency Injection, so we should still be able to talk about Type 1,2 and 3 frameworks I guess. Kevin DangoorFowler called Avalon's approach "Interface Injection", since it uses interfaces to determine what gets loaded. Personally, I agree with Fowler's point that "Interface", "Setter" and "Constructor" as the three different types of Dependency Injection are easier to remember than Type 1, 2 and 3. Sam NewmanKevin, that makes sense to me. Personally the people that talked about Type 1 IoC providing depedencies via services made no sense to me (in so much as EJB is type 1 IoC but doesn't use services in the same way as Avalon) PinocioDependency Injection is just a way of resolving dependencies in IoC. The are no equality here. What a confusing term. Dependency information is not injected anywhere, it is pulled out of the objects internals and grouped at the point at which they are constructed (where it should have been all along in a proper OO design). I don't understand why nobody uses any of the existing names for this architectural style (some which go back oh, 20 years at least). KevinSo I have built this plugin engine, similar to Eclipse. It is small, handles plugin lifecycle, dependencies, versioning, load/unload/reload at runtime, embeded jar/zip files within a single archive file (without needing to unzip to dir to use them at runtime), built around extension points and extensions. What is this then? Is it IoC? Or is it something else? It is built on the idea of using small, pluggable modules that can easily be worked into any application, shared across applications, etc. Being only 45K in size with embeded xml pull parser, I like to think of it as yet another container, perhaps a bit more than these IoC containers, but not sure. Leo SimonsAvalon is not dependency injection, it is service location. It's just that the service locator is then injected. According to the avalon definition of IoC, locating the service locator yourself is not IoC. Manish ShahI thought Martin's article gave a clear explanation of the differences between dependency injection and service location. However, for me it missed the key point of constructor dependency injection: Simplicity. When using Constructor Dependency Injection and TDD, your tests and classes can contain no infrastructure code to do with satisfying dependecies. It is easy to see what you are testing and what you are mocking. Whilst it is certainly possible to do TDD with the service locator pattern, the set-up and teardown code required makes tests unwieldy. Chiara"I don't understand why nobody uses any of the existing names for this architectural style (some which go back oh, 20 years at least)." Because Fowler likes to blow them off his ass and get credit for them with all the seriousness of a guy who is saving the world. Oh Fowler, shut up already. And it is funny, how now PicoContainer which is the b utt of jokes (sorry, is it needed? what the fuck is it for) are going to gain legality as a pattern itself. Phew, this stinks. Note: Pinocio didn't write the comment you refer to. |
|
||||||||||||||||
|
[RSS | RDF] © 2001-2004, Joe Walnes |
Powered by SiteMesh and Moveable Type. | |||||||||||||||||