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

I think you are confusing dependency injecting with frameworks that facilitate it. You are probably using the former with constructors


What's the difference? Isn't the 'injection' part the part where you don't need to connect point A and point B?


Sorta. The pattern is having standard method of injecting dependencies. Having a framework just saves you having to do the actual injecting, manually.

This is easy to see in frameworks like dagger, which compile time generate the boilerplate you could manually do.

And if everything is a singleton with no lifetime management, the framework doesn't buy you too much. The pattern, though, is kind of nice. I rarely have to question how a dependent section of code is linked to the one I'm at. (Contrast to python, where I don't know what is going to happen if I add that import...)


> (Contrast to python, where I don't know what is going to happen if I add that import...)

I felt that in my bones.




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

Search: