[Insight-developers] Module dependcies help

Brad King brad.king at kitware.com
Tue Jun 14 08:56:10 EDT 2011


On 06/13/2011 12:56 PM, M Stauffer (V) wrote:
> But there are other modules that use headers from
> ITK-RegistrationRefatoring, and if I include ITK-RegistrationRefatoring
> as a dependency in them in order to get to the RegistrationRefactoring
> headers, it goes circular. 

That probably means we have an implicit circular dependency among modules
that has just not been declared explicitly.  Can you cite an example of one
of these "other modules"?  Typically the solution is to either divide the
modules into smaller pieces to split the cycle, or to refactor the code
to break the dependencies leading to the cycle.

For example, the IO-Base module has ImageFileReader which gets reader
implementations from other IO-* modules that themselves depend on IO-Base.
Back when they were all in a monolithic IO kit the ImageFileReader actually
included headers from all supported readers.  During modularization the code
was refactored to use a factory with runtime registration so that
ImageFileReader does not need to include the headers of all supported readers.
This actually produced a better design because the reader does not force
a dependency on all the third-party code needed to support every format.

-Brad


More information about the Insight-developers mailing list