The Artima Developer Community
Sponsored Link

Java Buzz Forum
Transparent Inversion of Control

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
dion

Posts: 5028
Nickname: dion
Registered: Feb, 2003

Dion Almaer is the Editor-in-Chief for TheServerSide.com, and is an enterprise Java evangelist
Transparent Inversion of Control Posted: Nov 16, 2004 10:12 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by dion.
Original Post: Transparent Inversion of Control
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Latest Java Buzz Posts
Latest Java Buzz Posts by dion
Latest Posts From techno.blog(Dion)

Advertisement
Dave Thomas wrote a thoughtful entry on IoC and Ruby. He takes a look at one of the IoC implementations available for Ruby, Needle. One of the problems that Dave has with IoC is the "magic": One of the problems I have with the current IOC implementations is the "then a miracle happens" stuff. You’re looking at the source to a component, and do don’t really know how it is set up. In the example above, you assume that somehow the cust_model attribute is set to a class that implements a customer model, but it isn’t obvious. The same is true in Spring and friends—a whole lot of stuff happens behind the scenes, and some of that stuff is important. So he reworked his example to be more explicit and: attr_accessor :cust_model becomes: model :customer as well as a few other things. This does beg an interesting question. Is injecting dependencies with contructor/setter/getter all we want out of IoC? Or do we want to be more explicit? Is having an @Inject annotation explicit enough? I am personally quite happy with the level of "magic" that you get with IoC. When I write a component, I don't want to think about how a Foo is there for me to use. I just use it. Sometimes I do find that set*() is maybe overloaded, as it can mean "here are properties that will be set via injection. assume they are" or "if you want to set a property go for it". This is where the Constructor-based becomes useful. You *know* those dependencies are set. You can't "miss" one.

Read: Transparent Inversion of Control

Topic: Strange Java performance Previous Topic   Next Topic Topic: Another look at Groovy (Latest java based scripting language)

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use