Oovcde Index
Viewing C++ Project Cohesion (Code Zone Diagrams)
Have you ever wanted to view hundreds or thousands of classes of a project
at one time and their dependencies on each other? Traditional class diagrams
can show in the tens of classes, but often times these diagrams make it
difficult to understand relationships quickly.
A different way of viewing these classes is to use a circle diagram
where all of the classes are a single point on the circle. The classes are
grouped by directories. The dependencies are displayed as lines between
the classes. The lines are colored by the provider directory.
This first example shows the small Oovcde project that uses CLang to parse C++
and create these diagrams, but what if we need to display a million line project
such as LLVM? Showing lines between all classes is too much, so only lines
between directories are displayed where the classes are related. The
arrows can be turned on to indicate dependency direction. The following
diagram is the same project as the diagram above, but only shows class
dependencies between directories.
This makes it easier to see that oovcde and oovEdit are both related to
oovGuiCommon, and oovCommon, but the other components are not.
Another way to view the classes is to display each directory as a
separate circle diagram. This is the same information as the first
diagram, but is only laid out differently.
In UML class diagrams, class methods that have a relationship that use
other classes are typically not displayed. The Oovcde program allows
optionally visualizing these relationhips also. It also allows hovering
over the classes to see the class names.
Run the following to view these diagrams.
- Download the Oovcde Windows or Linux binaries from Sourceforge or
download the source from
SourceForge
or GitHub
- Extract the downloaded file to any location
- Run the oovcde program from the bin directory
- Run File/Open Project from the menu and browse to the
trunk/test directory and select the trunk-oovcde-...
file for linux or windows and press the Open button
- Wait for the analysis to complete.
- Click on the Zone tab to display the diagram
- Right click on "examples" in the list and select "Hide Children"
to remove the examples from the diagram
Viewing the LLVM project
Showing all classes for the LLVM project is pretty messy since it has over
3000 classes and somewhere near a million lines of code. I have never looked
at the source for LLVM, so let's see what we can learn. The LLVM project was
chosen simply because it is a large project.