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

DI frameworks always make me deal with way more of the system than I want to.

I want to just be able to 'new' any class in the system, and start playing with it under test.

When I try to test a Parser class under a framework DI, it ends up instantiating the most fiddly bits of unrelated crap. I get null pointers in the database config, which had nothing to do with what I wanted.

It can be controlled, by adding even more annotations and mocking frameworks. But I'd rather take out annotations rather than put them in.



But you don’t have to do it that way? You can still manually instantiate your Parser in your test and have DI




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: