Dependency Inversion Principle
Learn Dependency Inversion Principle by examples.
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Learn Dependency Inversion Principle by examples.
Comments
Simple & straightforward example. Nice. I may use it to explain the concept in the future.
I don’t think the criticism of the rspec book example is fair though: it’s a code example in a book designed to teach BDD, not patterns. Plus that specific example is so simplistic it doesn’t benefit from the change - especially since the abstraction has only one implemention. I would say your version of the rspec books code is over abstracted prematurely and makes the code worse.
Post a comment