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/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/9a2d304b6fe164c96217ea1ba5d85969%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to