← Graph

Why Not Inject Dependencies Via Rails Configuration?

question 2 connections

Audience member suggests the end-state design isn't very different from injecting the HTTP client through Rails configuration or an IoC container. Bellware disagrees on principle: one of his design objectives is that no mechanism other than the class's own implementation configures its dependencies. Delegating to Rails configuration couples the class to a foreign framework, forces tests to boot Rails configuration to run, and repeats mistakes the industry moved past in the 2000s when IoC containers were abandoned ('Angular didn't get the memo'). A class should configure its own operational dependencies — there are well-established patterns for doing so without an IoC container or configuration framework.

answer_summary
No — by design. The class itself should own its operational dependency wiring; external IoC containers or Rails configuration re-introduce the coupling problems the industry already outgrew.
question Why Not Inject Dependencies Via Rails Configuration?
about
The question challenges whether external configuration is equivalent to in-class dependency wiring.
question Why Not Inject Dependencies Via Rails Configuration?
asked_at
Audience question during the talk's Q&A.

Provenance