Joener Preagola wrote in post #1145843:
> Im not familiar on dependency injection
>
> Remove Car's explicit reference to Engine by using dependency injection.
The first question to ask yourself is, "Why is it important to use
dependency injection in this specific scenario?"
After all this is Ruby, not some lame statically typed language like
Java or something. In Java Dependency Injection (DI) is uses to solve a
lots of issues that are mostly due to limitations of the language
itself. In fact it requires looking outside of the language itself to
even support DI (i.e. XML configuration files or Java annotations).
There's a tendency to make DI sound like something magical or
complicated in the Java world, but in Ruby (and other dynamically typed
languages) you won't here much about it. Mostly because it's a really
simple concept with a really simple implementation.
--
Posted via
http://www.ruby-forum.com/.