Talk:Requests for comment/Dependency injection

The DI mechanism is a detail
Inversion of control is very important, and things such as constructor and setter injection can be used to achieve it. Applications then need to be able to construct their object graphs, and can do so in various ways, including by using a Dependency Injection Container (which seems to be what this RFC is about). The only part of the application that should know about the DI container is the part near it's entry points responsible for construction. A common thing that goes wrong in projects when they introduce a DI system is that it gets pulled in from all over the code and talked to directly, since people find that more convenient than actually requiring the depenedencies via constructor injection. (This is not an objection against proceeding - it's definitly good to proceed, one should just be careful about this pitfall.)

-- Jeroen De Dauw (talk) 20:55, 12 August 2014 (UTC)


 * Good point! --AGreen (WMF) (talk) 13:49, 21 August 2014 (UTC)

Good or bad?
I don't get the following statement which seems to contradict itself. --Nikerabbit (talk) 12:31, 15 August 2014 (UTC) "With regard to using RequestContext as a central registry, it seems that that does make sense since RequestContext appears throughout Mediawiki code, so using it would increase coupling, not loosen it."
 * Woops! Yeah, there's a "not" missing. I just fixed it. Thanks much! --AGreen (WMF) (talk) 13:50, 21 August 2014 (UTC)

I FooBar
I hate to knit pick but the whole I FooBar pattern fell out of favor in the Java community (where I come from) a while ago and seeing it here is sad. This is there a reason we need an interface at all? Java stopped needing it when we got better mocking. Is that not a thing in PHP?