From: Jamis Buck Date: 2004-11-19T12:12:06+09:00 Subject: Re: Memoization as Dependency Injection James Bowery wrote: > I'm probably missing something about the concept of dependency > injection (I'm sure I'm not the first) but what is it about DI that > isn't this reducible to memoization of getters? > > . > Well, DI is a lot more than caching the services that get created. For example, in Needle, you can have prototype services, which are created on every request instead of being cached. In fact, memoization of services is not even directly related to DI. That said, DI is all about some third party hooking up dependencies for an application. Think of it as an online dating system for your application components. _The container_ knows all the pieces, and it knows how to couple them all together as needed. Have you read Jim Weirich's article on dependency injection in Ruby? http://onestepback.org/index.cgi/Tech/Ruby/DependencyInjectionInRuby.rdoc If you haven't, you really ought to. If you have, I'd be happy to put in a few more words of clarification on the subject. - Jamis -- Jamis Buck jgb3@email.byu.edu http://www.jamisbuck.org/jamis