Following on from my previous post Decoupling: Electronics vs. Software – I felt as though I was missing a crucial point. While reading a text on Spring and DI, it occurred to me that theoretically DI is fairly straightforward, but the resulting code is difficult to interpret, or is it?
While it’s more difficult to say with confidence what a class will do, the point is that the class is now isolated and largely decoupled. What it does and who it need to collaborate with is determined by the configuration file and is set dynamically. And that was what was missing – the configuration file.
The configuration file is what determines how the application is assembled. It provides key insight into the infrastructure of the application. How the client can be used can be gleaned from looking at the unit tests, that should describe how the classes can be used.