This is going to be a tough question to describe, but here goes.
We are using the Delphi Spring Framework. (http://code.google.com/p/delphi-spring-framework/)
Let's say I have UnitA that declares InterfaceA which is implemented by ClassA.
Similarly, I have UnitB that declares InterfaceB which is implemented by ClassB.
Both registered their interface and their class with the Spring Container in their respective initialization sections.
InterfaceA has a dependency on InterfaceB, but because we are using Spring, UnitA doesn't have UnitB in its uses
clause. In other words, we've done our job -- we've decoupled UnitA and UnitB, but we still are able to have InterfaceA depend on InterfaceB.
However, given the above scenario, we need to make sure that both UnitA and UnitB are included in the project so that the dependencies can be resolved.
Imagine, now, that we start a new project. That new project uses UnitA, but the developer doesn't realize that if one is to use UnitA, one also has to include UnitB in the project. There will be no compiler error, because the dependency is resolved at run time, not compile time.
And herein lies the question: What is the right way to ensure that this dependency on UnitB is known before the app gets deployed?
We can foresee a situation in a complex app where, despite thorough testing, a given code path isn't executed possibly for a long time, and this missing dependency isn't discovered before deployment.
We've implemented a system where each interface resolution call is accompanied by a Requires
call that checks and raises an exception at startup, ensuring we'll see the error. But we are wondering if there is a "best practice" or standard way to detect this or otherwise deal with this issue.
Added: Is this an issue in Java and other languages?