Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://fabiokung.com/2010/05/06/ruby-and-dependency-injection-in-a-dynamic-world/" rel="noreferrer">http://fabiokung.com/2010/05/06/ruby-and-dependency-injection-in-a-dynamic-world/</a>: this is another, much less opinionated article than the James Buck article. Bottom line is that you don't need dependency injection because ruby provides plenty of good alternatives that work just as well and that don't really exist in the Java world.</p> <p>One of those alternatives is mixins, which is something Java does not have and the other one is the ability to override/redefine just about anything in the language. Other features include dynamic typing where basically you can send any message to any object and if it happens to provide an implementation for that message, things just work. All these things work together to remove much of the need for a DI framework. The design pattern as such is still valid in Ruby as well and sometimes it just makes sense to use it.</p> <p>Another point about DI that Alexey Petrushin above also makes is that dependency injection is primarily a design pattern and that the tooling is secondary and mostly about getting rid of the tediousness of certain things in Java. In ruby, you can trivially emulate most of what spring or guice do for you in Java. So a full blown dependency injection framework is essentially redundant in Ruby.</p> <p>That being said, sometimes having a DI framework is kind of nice since ultimately it can take away some of the tediousness of wiring stuff up. I can't vouch for any Ruby specific DI frameworks but I know of a lot of Ruby projects that ultimately got rewritten in another language (Java even) because the playdoh nature of things causes things to become hard to maintain/extend. I suspect this has a lot to do with developers shooting themselves in the foot with the various powerful language features. Having a DI framework imposes a bit of structure and idioms that may help prevent this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload