Hacker News new | past | comments | ask | show | jobs | submit login

This is not at all the definition of Dependency Injection. The wikipedia article [1] does a pretty good job of describing what it really is. DI is a pattern that is intended to reduce coupling between components in a large system. It applies to any OOP language, although it is true to say that the term first gained popularity in the "enterprise" Java world.

I also think it's wrong to conflate DI with XML. One of the first major DI frameworks, Spring, did use XML for configuring and wiring-up components, but it's also quite popular to do this part purely in the code, without any external configuration files.

[1] http://en.wikipedia.org/wiki/Dependency_injection




> This is not at all the definition of Dependency Injection.

Re-read fleitz message. He never stated what he believed DI to be but what he believes DI to be used for.

> I also think it's wrong to conflate DI with XML.

Which, again, is not what he said at all.


To be honest, I didn't really understand what he was trying to say, but I am certain that the first two problems he mentions are not what DI is intended to solve.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: