Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Passing 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.


Furthermore, this enables creating sub-contexts (like run this operation but with this different configuration) which is something almost impossible to do with DI frameworks.


Yeah, 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.


That is DI. The difference is that you're using a registry or container object as your DI repository.


I 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?).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: