Analyzing Unit Dependencies: uses, used by, and cyclic relations
Analyzing Unit dependencies is an important task in Delphi development:
- It helps managing coupling and re-usability on unit level.
- It helps avoiding unwanted linking of units.
- When using runtime or design time packages controlling which units are included in which package is essential.
- Complex cyclic unit relations can considerably increase compilation times up to hours. A cyclic dependency is formed when unit A uses unit B and unit B on its turn (indirectly) uses unit A. Reducing cycles can enormously speed up compilation.
- In some cases complex cyclic unit dependencies can even lead to internal compiler errors and uncompilable code. The only way out is to eliminate the cyclic dependencies or make them less complex.
The ModelMaker Tools Unit Dependency Analyzer parses any root file and build a uses and used-by relations tree. Cyclic unit relations are instantly visible and can be analyzed as text and using a Dependency Structure Matrix. It analyzes both .dpr and *.pas files. Compiler options and conditional defines are interpreted.
Check the Unit Dependencies demo movie
uses relations are instantly browsable to any level.
used by relations (dependencies) are instantly browsable to any level.
Cyclic uses relations are instantly available and browsable. A Cyclic dependencies filter helps locating just those files that have cyclic uses relations with other units.
To help analyzing complex Cyclic uses relations the cycle can be viewed in a Dependency Structure Matrix.
ModelMaker Tools Unit dependency analyzer is integrated in ModelMaker Code Explorer for Delphi IDEs.