RubyFlow The Ruby and Rails community linklog

Decoupling Ruby: Delegation vs Dependency Injection

We’ve all worked with tightly-coupled code. If a butterfly flaps its wings in China, the unit tests break. Maintaining a system like this is…unpleasant. In this article, Jonathan Miles dives into the origins of tight-coupling. He demonstrates how you can use dependency injection (DI) to decouple code. Then he introduces a novel decoupling technique based on delegation that can be useful when DI is not an option. https://www.honeybadger.io/blog/decoupling-ruby-delegation-dependency-injection/

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in