Requests for comment/Dependency injection/2014: Difference between revisions
Appearance
Content deleted Content added
AGreen (WMF) (talk | contribs) Initial summary and outline |
AGreen (WMF) (talk | contribs) Started on Problem statement section, tweaked intro |
||
Line 6: | Line 6: | ||
}} |
}} |
||
This RFC proposes a lightweight mechanism for dependency injection. An implementation with tests and examples is provided. |
This RFC proposes a lightweight mechanism for [[w:Dependency injection|dependency injection]]. An [[#Proposed implementation|implementation]] with tests and examples is provided. We could combine a facility like this with improved autoloading, and could add it to core as a first step in an iterative development process. Other options are also discussed. |
||
== Problem statement == |
== Problem statement == |
||
[[w:Dependency injection|Dependency injection]] is a design pattern that can facilitate unit testing, loose coupling and architecture description.<ref>http://martinfowler.com/articles/injection.html</ref><ref>http://blog.crazybob.org/2007/06/introduction-to-guice-video-redux.html</ref><ref>http://code.tutsplus.com/tutorials/dependency-injection-in-php--net-28146</ref> Although its benefits and popularity vary from one language to another, it is a well-established pattern with a solid ecosystem of supporting libraries for PHP.<ref>https://packagist.org/packages/symfony/dependency-injection</ref><ref>http://phptrends.com/category/73</ref> |
|||
== Previous discussions == |
== Previous discussions == |
||
== Proposed methodology == |
== Proposed methodology == |
||
== Proposed implementation == |
== Proposed implementation == |
||
== Other options == |
== Other options == |
||
== References == |
|||
<references /> |
Revision as of 18:09, 25 June 2014
2014 | |
---|---|
Component | General |
Creation date | |
Author(s) | Andrew Green |
Document status | drafting, seeking initial feedback |
This RFC proposes a lightweight mechanism for dependency injection. An implementation with tests and examples is provided. We could combine a facility like this with improved autoloading, and could add it to core as a first step in an iterative development process. Other options are also discussed.
Problem statement
Dependency injection is a design pattern that can facilitate unit testing, loose coupling and architecture description.[1][2][3] Although its benefits and popularity vary from one language to another, it is a well-established pattern with a solid ecosystem of supporting libraries for PHP.[4][5]