Structural analysis

The first step to controlling something is to understand it. Structure101 creates a model of your code in seconds, and then lets you browse and analyze its structure in different ways. Here are some applications of Structure101 structural analysis capabilities.

Java structural analysis

Dependency management. See the dependencies within your code-base at any level, such as: method to method, function to type, class to class, package to class, directory to directory, jar to jar, etc.

Dependency analysis. For any dependency, at any level of composition, discover the dependency's source with the click of the mouse.

Impact analysis. Find out the impact of making a code-change, replacing a library, etc., before the team changes a single line of code.

Understanding unstructured code. Even where the code-base has become overly complex and unstructured, Structure101 gives you ways to cut through the raw structural data and make sense of it all. For example, auto-partitioning isolates tangled items and natural clusters and dependency matrices makes large graphs more readable.

Deep structural analysis. Structure101 lets you view your code organized into different hierarchies (e.g. by package or by jar). It also lets you take slices through the whole code-base at different levels (e.g. class, package or design). "Tagging" lets you see how items in one hierarchy or slice map to other hierarchies or slices.

Structural transformations. Use simple mapping expressions to transform the model hierarchy. For example, isolate test code, combine API and implementation packages, etc.

Dependency Management

Dependencies by XKCD

You are probably reasonably familiar with the dependencies that are close to your project code, such as which methods call which other methods, which classes extend which other classes. But what does the big picture look like? How do all the code-level dependencies affect dependencies at the higher abstraction levels? As you browse the hierarchy, structure101's dependency management capability automatically generates and lays out dependency graphs instantly.

Figure: Jar-level dependencies (contents of a deployment). Full screenshot

Java dependency management - jar-level

Figure: Package-level dependencies (contents of a higher-level package). Full screenshot

Java dependency management - package-level

Figure: Class-level dependencies (contents of a package). Full screenshot

Java dependency management - class-level

Figure: Method-level dependencies (contents of a class). Full screenshot

Java dependency management - method-level

Dependency Analysis

When you wish to analyze dependencies you can start browsing the dependencies at different levels of your code-base hierarchy, you'll probably see dependencies that you were not expecting.  Just selecting the dependency in the graph will reveal all of the lower-level dependencies that cause it. 

Figure:The hierarchy of items that cause the dependency. Full screenshot

java dependency analysis - dependency hierarchy

Figure: All the classes that cause the dependency.Full screenshot

java dependency analysis - dependency classes

Figure: The list of references that cause the dependency.
Full screenshot

java dependency analysis - code-level dependencies

Impact Analysis

The Collaboration Perspective lets you find out exactly how any item is used, or what it depends on. Structure101's impact analysis capability can show you this information by greying out any unconnected items in the hierarchy, providing a list of the connected classes, or the list of code-level references. This can be valuable if you want to understand the impact of changing or replacing the item, or if you wish to deploy or reuse the item and need to know what it depends on.

Figure: You can ask structure101 to include external libraries in the model. They are shown with a warning symbol (External library icon). These are items that are not part of your project but that you depend on.Full screenshot

see the impact of removing or replacing a third party library

Figure: If you want to understand how much and where an item is used, select it here and structure101 will grey out anything that doesn't use it. Really useful e.g. if you want to remove or replace a 3rd party product.Full screenshot

the 'collaboration perspective' is a good place to do Java impact analysis

Figure: Structure101 also shows you the classes that use the selected item, and lists all the code-level references.Full screenshot

class-level Java impact analysis

Understanding unstructured ("Fat") code

It is very common for packages and classes to outgrow themselves.  Big fat packages or classes tend to be difficult to work with because they lack the structure that helps to guide human understanding.  Structure101's software visualization helps by letting you view even very large dependency graphs of the package or class contents.  To help further, structure101 can perform an Auto-partition on the graph, to reveal the hidden, inherent structure.  As well has helping you understand what you've got, seeing the inherent structure may help you to decide how to add structure by creating sub-packages or classes.

Structure101 can also present dependency graphs as matrices which can handle very large graphs in a relatively condensed form.

Figure: The overview window gives you a birds eye view of large graphs, letting you pan around to see the details.Full screenshot

pan around large software dependency graphs using the overview window

Figure: The Auto-partition button partitions a large graph into its natural clusters. Full screenshot

structure101 partitions large software dependency graphs

Figure: You can find unstructured items ("Fat") at any level using the Notables.Full screenshot

structure101 finds large software dependency graphs in your project

Figure: You can ask structure101 to present dependency graphs in the form of a matrix. The rows and columns are sorted so that, as much as possible, items only use items below or to the right. Populated cells above the diagonal indicate tangles. Full screenshot

view very large software dependency graphs as dependency matrixes

Deep Structural Analysis

Structure is very complex stuff. Not only are there a vast number of dependencies, but these dependencies cause other dependencies at different levels in different hierarchies. Structure101 lets you deal with this by giving you access to many different slices and hierarchies, and then letting you "tag" (or mark) items viewed in one view and see how the items map onto other views.

Figure: In the Slice perspective, the "leaf package" level is selected and we see that there is one very disruptive tangle consisting of 20 nodes spread across 11 parent packages.
(full screenshot here)

The slice perspective lets you easily find cyclic dependencies in Java at any level of detail

Figure: "Tagging" the tangle in the leaf package slice causes all the items involved in the tangle to be marked. Switching to the package hierarchy, it is clear how the tangle is distributed through the package hierarchy by following the blue dots.
(full screenshot here)

tagging lets you understand how cyclic dependencies in Java roll up though the package hierarchy

Transformations

You may find that the physical structure of your code (e.g. the package hierarchy) does not conform directly to the way that you understand the architecture - perhaps several packages correspond to a single architectural component, or the contents of a single package map to several architectural components.

Or, you may wish to see how various packages or classes that are distributed across the package hierarchy relate to each other.

Structure101 supports you in this type of situation by providing a simple but powerful regular-expression notation from which you can define structural transformations.

For more details on how to use structure101's Transformations check out the structure101 online help.