Hello!
I'm a huge fan of D.I.
I'm currently developing a not-so-small project which uses D.I. everywhere
(classic and beautiful D.I. by hand).
From my point of view there are following advantages:
- It's intuitive when you got used to it,
- doesn't affect readability in negative way (in fact, it gets even better),
- but the most important thing is: if I want to test parts or whole project with different implementations of some interfaces, I can do it by changing few characters, instead of doing complex refactoring/renaming or other workarounds.
But, sadly, I can't figure out, how D.I. can be used with foreign-created objects in an elegant way (without some frameworks, remember, I do D.I. by hand).
D.I. by hand means: you pass something to a c-tor. No global factories or similar, God forbid!
JAXB, for example, creates objects by itself. There is no way to tell the JAXBContext: "please, use following parameters to create my objects". JAXB only accepts parameterless c-tors.
Any ideas?