IoC is a big hammer, but DI happens every day in Ruby / Rails. Whenever you do:
def initialize(model_klass) @model_klass = model_klass end
This is DI. This paradigm is also used in various places in the Rails source code. For example, the Railties stone Railties is basically a DI engine. You can enter your preferred ORM, various plugin configurations and generators.
Injection Dependency has a big and scary name, but what it minimizes is simply to untie class dependencies by injecting dependencies at run time.
It doesn't matter what language you use, if you need to connect behavior / code somewhere, you are probably using it.
Aaron Qian Feb 19 '13 at 19:36 2013-02-19 19:36
source share