3 ms·
Usable IoC actually can be implemented in just 4-5 classes. Yes, it won't be as powerful as Guice but for some (or a lot?) of applications it's probably enough.
by ivanche 6y ago
Usable IoC actually can be implemented in just 4-5 classes. Yes, it won't be as powerful as Guice but for some (or a lot?) of applications it's probably enough.
[0] http://misko.hevery.com/2010/05/26/do-it-yourself-dependency-injection/ http://misko.hevery.com/2010/05/26/do-it-yourself-dependency...
[1] http://blacksheep.parry.org/wp-content/uploads/2010/03/DIY-DI.pdf http://blacksheep.parry.org/wp-content/uploads/2010/03/DIY-D...
- withinboredom 6y agoCompared to just creating your own dependencies inside a class and not writing interfaces, IOC adds a great deal of complexity.
- ivanche 6y agoYou don't have to write interfaces to have dependency injection. You can and should declare all your dependencies as constructor parameters. If you create them inside a class you'll permanently lock the two together, thus making it a testability nightmare.