Hacker News new | ask | show | jobs
by UK-AL 4569 days ago
"It fosters Anti-Patterns like 'Dependency Injection' that give you the illusion of modularity but instead create dependencies within the application ('Dependency Injection' needs to be taken literally)."

What? Any system with separated modules is going to have dependencies. At least with DI, classes are written to a interface and different versions easily be swapped in and out.

1 comments

> Any system with separated modules is going to have dependencies.

Thank you. I thought I was the only doing my nut in over "I've done DI, now I have all the same dependencies" ... adds DIC ... "Now I have all the same dependencies but higher up, and.. oh I need to add logging to 80% of the objects" [Goes to kill myself]

I have OCD about writing beautiful code. The more I try, it seems to real world prevents it from happening.

Eager to learn so if good demo code, resources, books or I'm missing something (obvious or not) I'm all ears.

Try dependency management instead of dependency injection. Layered, modular, hierarchical design instead of 'anything injected into anything'. Divide and conquer instead of DI spaghetti. Testable independent modules instead of mocked-out stubs...
If you want to promote an alternate paradigm you might want to learn to directly argue in favor of your alternative, tather than randomly attacking things that don't fit your personal aesthetics.

I'm also not particularly enamored with the current state of affairs although my pet peeve is more with the lack of adoption of functional reactive programming. That doesn't mean though that I refuse to acknowledge what (or when) Spring was good for or how it fits into the evolution of the industry.