Monday, February 1, 2010

Dependency Injection in Ruby

I had an opportunity to use DI in one of my past company projects. Since I have made a switch to Ruby at work, just wanted explore DI in ruby world.

Before that I should mention that Ruby is focus on simplicity and productivity. Syntax in ruby is elegant and easy to read/write.

Initially I was under impression that DI equals Spring, but that's not entirely true. In simple terms, DI contributes to mitigate the proliferation of dependencies. A good example is use of factory class is most common way to implement DI.

In ruby, DI concepts to creation of objects and wiring them...
Example: TBAdded later...