views:

67

answers:

2

Here is our dependency tree: BigApp -> Child Apps -> Libraries

ALL of our components are HEAVILY using one of the Libraries as above ( LibA). But it has a ‘few’ public methods that require classes from ‘higher-level’ assemblies and we want to avoid CIRCULAR references. What do you propose as a good design for this?

+2  A: 

Depending on the specifics of your situation, you could define interfaces to abstract some of the functionality of one or more of your classes. You then reference the interfaces where you think you might induce a circular dependency.

andand
+4  A: 

One typical way of avoiding such things is by creating an interface that doesn't depend on anything. Then BigApp and LibA can both depend on the interface. BigApp can supply a concrete implementation of the interface and then pass that object to LibA at some point before it gets used.

Jeffrey L Whitledge