3 ms·
>I'm just passing dependencies through constructor and it works just fine. Eventually its gets unwieldy when you have lots of classes. I've worked on old code
by wcummings 9y ago
>I'm just passing dependencies through constructor and it works just fine.
Eventually its gets unwieldy when you have lots of classes. I've worked on old code in that style (DI w/o a library), it produces a lot of boilerplate. Piles and piles of "container" classes filled with deps getting passed around gets real old, real fast.
I strongly encourage people to use a framework like guice.
- weberc2 9y agoThere are two parts to the problem. The first is that many languages (like Java) require a bit more boilerplate than others (like JSON) to express a composition of objects. The other problem is that complex applications have a very large number of compositions, so the overall pain is the product of the number of compositions and the boilerplate per composition. The number of compositions is a necessary evil--a framework won't fix it, but a framework can fix the per composition cost by moving the compositions into a cleaner language. Go solves this problem without a framework simply by having convenient syntax for composition.
- deleted 9y ago[deleted]
- vbezhenar 9y ago> Eventually its gets unwieldy when you have lots of classes. Yep, if application started to grow, it'll require significant refactoring at some stage. But many application won't grow and using framework for something like 5 services looks like overkill for me.