View Single Post
  #3 (permalink)  
Old January 27th, 2011, 09:01 AM
MrFixxiT MrFixxiT is offline
Registered User
Join Date: Jan 2011
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks for answering, but... :)

In that example you (or Fowler) uses the Locator inside the MovieLister class. Maybe that's when it's offcially called a Service Locator. If you still use DI via the constructor for the MovieLister class, like in the first example, and then use a Locator when instancing the MovieLister class to insert all the dependecies into the MovieLister class, it's almost the same as with the IoC container. The only difference being that you have to write all of the Service Locator yourself.

The advantage has to do with the location of asking for the concrete implementation.

And like I said, the auto-wiring is cool and a genuine advantage over writing heave Service Locator classes that do the dependency chains by themselves.
Reply With Quote