Understanding Class Design, Dependencies and Usage

The data hiding features of object oriented programming - abstraction and encapsulation - offer many advantages when developing software. In particular, they limit the amount of information necessary to utilize existing classes. The downside of this data hiding occurs when making changes to a class or assessing its usability in a different context. There, it can be difficult to comprehend a class's inner workings and overall usage model. This is due to the challenge of understanding enough of the multifaceted nature of the class to ensure that any changes are compatible with its current use and in line with the original design intent.

Achieving the requisite understanding is one of the primary applications of Imagix 4D as a source code analysis tool. The particular focus of this app note is on Imagix 4D's Analyzer feature, and how its series of easily accessed displays provide a clear and comprehensive analysis of a class, its usage and dependencies.
Analyzer tab for class
Available for any symbol in your source code, Imagix 4D's Analyzer feature displays a list of graph alternatives, each of which shows a different aspect of the symbol you have focused on. The alternatives are specific for the focus symbol, based on both the general type of the symbol and such specifics as how the symbol is used. Together, the resulting graphs provide an encyclopedic visual source code analysis of the symbol.

When the analyzed symbol is a class, the menu contains six sections. The first of these is the Public Interface. Graphs in this section show the externally-available public members of a class, along with how they then interface with the class's private and protected members.

Class graph alternatives (Full Size)
The Internal Calling Hierarchy section also examines just the members within a class. Here though, the analysis helps with a more thorough understanding of the dependencies among all class members.

Use of Members views provide insight into how the class's members are used throughout your software. The analysis results are presented both at the level of individual members and as UML Class Diagrams.

UML Class Diagrams are also one of the formats used for displaying the external Dependencies of a class, those functions and variables outside the class that are called, set and read by class members.

And Class Inheritance shows various perspectives on how the specific class fits within the overall inheritance of your class structure.

These first five Analyze menu sections deal with source code analysis views that are focused on the one focus class. The sixth section enables you to study the Relationship of the class with any other class you select.

Analyzing Class Design,
Usage and Dependencies