Crank It Up
Starting the program from either the program group or the C:\Program Files\Structure101\java\ s101java.exe program opens what looks like a familiar windows application with the standard menus and toolbars.
The first step is to create a new project using either the menu or the toolbar icon. I created separate projects to analyze the JAR files for JUnit 3.8.1, JUnit 4.1, and Spring 2.0, as well as some client code. You can set the level of detail you want to include in the project, which impacts the amount of time it takes to parse and analyze the byte code. Each of these projects was created in 15 seconds or less, and the analysis was immediately available in the application.
One of the metrics Structure101 provides is called XS, which is a measure of how much "excess" is in the structure of your code; the lower the number the better. The XS measurements for the open source projects I analyzed were:
- JUnit 3.8.1: 485 (4.4%)
- JUnit 4.1: 845 (10.9%)
- Spring 2.0: 5,200 (2.5%) (see Figure 3)
From the XS View, you can adjust the thresholds and rerun the analysis. You can also select each slice of the pie chart to filter by that metric. To get more detail simply double click on one of the classes in the Items View and you will be transported to the are of the dependency graph where that class is to do further analysis.
|Figure 3. Here the XS metrics for Spring 2.0 are shown. The five metrics in the lower left corner are set to their default thresholds, and can be customized. Using the defaults, only two metrics exceeded the thresholds: Fat (method) and Fat (class), as shown in the pie chart. The class-by-class breakdown of the violation is shown in the 31 classes listed in the lower right corner.|
These numbers indicate an overall measurement of how well these libraries are structured. I was impressed to see that as large as the Spring 2.0 code base is, it had a very low XS rating. Likewise I was disappointed to see that the XS rating for JUnit has more than double from version 3.8.1 to version 4.1. Of course this is exactly the kind of thing Structure101 is supposed to do; point out complexity and poor structure in your code.
There are several areas to explore for each code base in Structure101, but XS is a good high-level place to start comparing versions of code you write and maintain. This also gives you another way of comparing third-party libraries; Structure101 can give you some quick insight into how well they are designed, which may translate into how much support impact they will have on your applications.
It can be easy to get lost in any good size code base. One way that Structure101 has to help you keep track of where you are is a tagging feature. As you identify methods, classes, and packages that you want to hone it on you can filter whatever view you are looking at by selecting the package, class, or method of interest. Once you leave that view or select another item the filter changes to the new selection. If you want to leave yourself some breadcrumbs of where you've been as you trek through your code you can tag items of interest. Structure101 provides a set of tag/untag features available from the menu, toolbar, and context menus from almost any view. Want to see the inverse of what you've selected? Just toggle the tagged items to be untagged and the untagged items to be tagged with the inversion option. You can invert tags separately on selected items, as well as dependencies. You can also hide all the tagged items so that you can see what's left in the model, which can be useful if you are doing a significant refactoring.
Another Structure101 feature is the ability to transform the visual model of the code structure. One example covered in the documentation is when your unit tests are located in the same package as the classes they test, and you want to separate them out to a parallel package structure. You can transform the visual representation of the code inside Structure101 to represent whatever your new, preferred structure might be. The tip in the online help says, "Don't be afraid to experiment with Transformationsthey are transient and you cannot break anything."
What I Liked
The Windows installer absolutely meets the desired and sometimes mythical 10-minute installation. It was easy and straightforward, with instructions of what to do if the license key has not been installed the first time the program is run.
I liked the visual aspects of the program, how it visually depicted the relationships between various modules, packages, classes, and methods of a code base. Features such as the birds-eye view and the auto-partitioning were reminiscent of computer drafting programs, and their application here is extremely apropos. The ability you have to click through and navigate up and down the structure of the code base is both eye opening and addictive (see figures 4 and 5).
Figure 4. Uh-Oh, looks like JUnit 4.1 has a "tangle of 8" that needs to be addressed. The Dependency graph shows the circular relationships at the package level. Someone ought to fix this!
Figure 5. JUnit 4.1 appears to have a cluster of 18 packages involved in this tangle. The birds-eye view in the upper-left corner of the dependency graph is helpful for navigating large graphs, where the whole graph is too big to see at one time.
I like that you can select whether you want to see the detail view of the code base including the inner classes and their dependencies or only the overview of everything rolled up to the class level. The additional ability to include or exclude references to any third-party libraries used by your code is also very useful.
I found the online Flash tutorials great to not only get familiar with the Structure101 concepts, but also to see some of the intent for how its designers envision it being used. The only complaint here was that the demos are of a previous version, and so not all of the newer features are demonstrated. The vendor states these should be updated shortly to incorporate the latest version.
The help system that is built into Structure101 was brief and to the point. It's great for beginners and for describing seldom-used features; however I found it sketchy on the more advanced features like running from the command line or publishing results to the repository. I don't think it would be that much effort to upgrade the documentation of advanced features, and this product would greatly benefit from that additional detail.
What I Didn't Like
I didn't like that there was no option to download the program without a Java runtime. It seems to me that most Java developers and architects I knowat least the ones likely to use a product like Structure 101are going to have Java already installed, usually several versions. I don't mind having the one-stop install, but I prefer vendors to give me the option not to download yet another JRE that may get entangled in my PATH, CLASSPATH, or Registry (on Windows). This may seem like a small thing, but with all the tools and configurations that developers have to manage nowadays, I think vendors will need to continue to search for a balance in how their target audience can most easily assimilate their products into a constantly changing environment. It's not like an automated installer has ever done that kind of thing to me or anything…
Structure101 reads JAR files and .class files, in other words Java byte code. It doesn't handle WAR or EAR files. While there are work arounds such as pointing Structure101 at an exploded WAR or EAR, I'd prefer the ability to analyze them directly. While it's true that WARs/EARs typically include JARs, which can be processed by Structure101, my experience has shown it to be much more common for WARs/EARs to be comprised of .class files that are not contained in JARs before being added to the final WAR/EAR they are deployed in. For this product to be adopted as a standard in enterprise developers'/architects' toolboxes, direct support for WARs/EARs is not a nice to have, it's a requirement.
Filling a Need
There's been a need for a tool like Structure101 for a very long time. The tool had no problems reading any JARs or directories containing .class files from any of the various open source or personal code bases I pointed it at.
Overall I would recommend that tech leads and architects evaluate this product to determine if it could assist you in keeping up with all the various aspects of your ever growing code base. I think that development teams of almost every size would benefit from at least one copy of Structure101. Larger teams could utilize the repository and publisher license to maximize their investment. The value of Structure101 is more about complexity of your code, than the size of your team.
|Figure 6. Here we see auto-partitioning at work on the Spring 2.0 code. Notice the overall view in the upper left corner.||
|Figure 7. If auto-partitioning is turned off, you get a true picture of the overall structure of the code. Auto-partitioning helps you to find the most complex parts of your code.||
|Figure 8. If you don't like the Dependency graph, you have the option to view dependencies in a matrix view.||
The performance was acceptable, and I experienced no crashes. At $499 USD per developer license or $999 USD for the publisher license, it's in the affordable range for most software teams. I doubt that every developer would need a copy, but the team would benefit from having a tech lead or architect who could use Structure101 to analyze the code base, and work with the rest of the development team to improve the structure.
I give Structure101 a thumbs-up and look forward to their next release and extended Java and .NET support.