Matthew Riley wrote in post #1141041:
> I understand the code is not specific to Rails, however I am
> specifically
> interested in Rails developer's perspective. Thanks!
Perspective on what? As you demonstrate, Dependency Injection (DI) is a
really simple concept, with a really simple implementation, in dynamic
("Duck Typed") languages like Ruby.
Are you asking to verify what you have shown is "Dependency
Inject/Inversion of Control?" If so then sure it is.
Are you asking if Rails developers spend a lot of time worrying about
"Dependency Injection" or creating elaborate frameworks to support DI?
That would be a pretty resounding "NO".
Given that a high percentage of DI usage is related to testability, it
might do you good to look at one of the popular testing frameworks used
by Rails developers, for example:
https://github.com/rspec/rspec
You won't see a lot of talk in there about DI or IoC mumbo-jumbo. You'll
see the stuff that's actually important, like test doubles, mocks,
stubs, etc. Ruby is a dynamically typed language without all those pesky
static type dependencies. Take advantage of that in whatever way makes
sense.
--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ffa4e95419882d5fd694e225e0cbd562%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment