4 ms·
> I think anyone arguing for frameworks should spend some time making a serious attempt at frameworkless dependency injection. The frameworks are really doing s
by clumsysmurf 4y ago
> I think anyone arguing for frameworks should spend some time making a serious attempt at frameworkless dependency injection. The frameworks are really doing so little for you, at occasionally horrendous cost.
That is what I did, and decided a DI framework was much better. If you have a single scope, like singletons, its pretty easy to do the wiring manually. If not, then you see very quickly that your scope management code and rewiring of same things at different layer quickly becomes tedious, error prone (becoming out of sync with another wiring), boilerplate.
- hot_gril 4y agoPassing a single "context" struct/class/whatever into everything basically solves DI. I can see using a framework for this, but it doesn't seem necessary.
- javcasas 4y agoFurthermore, this enables creating sub-contexts (like run this operation but with this different configuration) which is something almost impossible to do with DI frameworks.
- hot_gril 4y agoYeah, it's weird how such heavy frameworks often end up lacking basic features like this. That's like the first thing I'd look up how to do after the basic tutorial.
- aforwardslash 4y agoThat is DI. The difference is that you're using a registry or container object as your DI repository.
- hot_gril 4y agoI know. DI is solved easily without a framework. Idk why there's even a word for DI; never occurred to me how else you're supposed to code (globals?).