Memoization as Dependency Injection

Discussion in 'Ruby' started by James Bowery, Nov 19, 2004.

  1. James Bowery

    James Bowery Guest

    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?
     
    James Bowery, Nov 19, 2004
    #1
    1. Advertising

  2. James Bowery

    Jamis Buck Guest

    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

    http://www.jamisbuck.org/jamis
     
    Jamis Buck, Nov 19, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?iso-8859-1?B?bW9vcJk=?=

    How to build a dependency injection framework by myself?

    =?iso-8859-1?B?bW9vcJk=?=, Aug 24, 2006, in forum: Java
    Replies:
    4
    Views:
    414
    PerfectDayToChaseTornados
    Aug 24, 2006
  2. Michael Feathers

    Dependency Injection in C++

    Michael Feathers, Oct 11, 2006, in forum: C++
    Replies:
    5
    Views:
    7,449
    F.J.K.
    Oct 13, 2006
  3. Anonieko

    What is Dependency Injection?

    Anonieko, Oct 14, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    311
    Michael Nemtsev, MVP
    Oct 14, 2007
  4. Danno
    Replies:
    12
    Views:
    719
    Ke Jin
    Apr 10, 2008
  5. Philipp
    Replies:
    8
    Views:
    658
    Owen Jacobson
    Jun 29, 2009
Loading...

Share This Page