Dependency Analysis

Dependency Analysis

Dependency analysis is usually a static code analysis process, but in some cases it can be practiced on data from dynamic analysis.

Purposes of Dependency Analysis 

Dependency analysis can be used to

  • Document and explain the existing design of the system in order to speed up e.g. job rotation or new developer induction
  • Verify the structural and architectural quality of the system, which is important when preventing anti patterns like God Class, or the dependency hell situation
  • Clarify and visualize the change for the human (as a reviewer)  (how the code under review is going to change the existing software design)
  • Clarify and visualize the change for the human (as an author of the changes)  (how the changes under construction are going to change the existing software design)
  • Evaluate the responsibilities of the components, in order to better plan the next functionalities and their architectural impacts

Dependency Analysis in Static Code Analysis

Source code is parsed and handled in order to retrieve information on releationships, also called as dependencies, between software artifacts. Usually it is done for detecting file to file usage relationships or class to class relationships. For example, with TypeScript analysis madge tool can detect dependencies between code files.

Analyzers and parsers can be used to abstract software concepts, to identify e.g. specialties such as Signals and Slots of Qt Framework, and then analyze the concrete connection creating statements with help of parsing and handling of syntax trees.

Dependency Analysis in Dynamic Code Analysis

With help of execution of instrumented software, an analyzer can resolve concrete function or file usage relationships based on the data collected from a test case execution or from a real production environment. However, this approach is limited to availability of the instrumentation, and to the availability of the data.