Skip to content

Comment on Dependency Injection for Pythonparent

Comments

The direct opposite of Dependency Injection is the Service Locator pattern.

You're right in spirit, but the direct opposite of dependency injection is obviously direct dependency construction, not service location.

Service location is one step up from direct dependency construction, and can be enough for a lot of cases, but as you say, it's not dependency injection.

You're right in spirit, but the direct opposite of dependency injection is obviously direct dependency construction, not service location.

Fair call!

another thing - there are multiple ways to inject dependencies - not just constructor injection.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.