Thoughts Made Words
Todd Hoff's Weblog.






Subscribe to "Thoughts Made Words" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.


Sunday, November 07, 2004
 

Excellent Article on Inversion of Control Containers

Mike Spille has a great article on Inversion of Control at http://www.pyrasun.com/mike/mt/archives/2004/11/06/15.46.14/index.html . I really enjoy his take no shit with humor writing style. Plus it is a really good introduction to IoC and the different IoC packages.

Personally i have never understood IoC. IoC reminds of Kiss, the Prince song that says:
U got to not talk dirty, baby
If u wanna impress me
U can't be 2 flirty, mama
I know how 2 undress me (Yeah)

Just create your objects and wire them up. Adding the extra levels of indirection and configuration files has made no sense to me. I like to see the code rather than hiding it behind another framework. I really don't need an XML description language to encode the dependencies that i can easily actually code.

Nor do i agree with him on the evil of singletons. Singletons are a service level access mechanism that makes it clear from the package documentation what is going on. If a singleton won't do then transform the singleton into a factory that takes contruction criteria and you are done. Couldn't be simpler or clearer in the code.

For example, in the dom code, when i need a document builder, all i need to do is:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

That is simple and obvious. I don't care which builder was installed, i just use it. Why do i need more infrastructure than this?

It took me a while that IoC was for service level objects, not domain objects. This to me makes IoC even more useless. Somehow i can manage the complexity of domain object wiring but i need help with service level objects? Don't think so.

comment[]

12:15:28 PM    



Click here to visit the Radio UserLand website. © Copyright 2006 todd hoff.
Last update: 7/11/2006; 1:11:49 PM.
November 2004
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        
Oct   Dec