In my recent posts, Meet the Clones in My Neighborhood and You're Only as JUNG as You Feel, I mentioned how JUNG could be used to extract clusters of cloned code from a complex graph of an entire application. This has been very helpful to drill down into code to look at sub clusters as in the tiled image below. (I’ve substituted number for module names, since this is actual code.) But even with this simplified image, the team wanted to convey more meaning in our next generation tool: Visual Intelligence Explorer. The amazing thing about JUNG is that it allows our team to have complete control over the image rendering process. So we can control how the lines are drawn between the nodes. Up till now, with other tools, we’ve been coloring the lines, green for a weak relationship, red for a strong one. But using JUNG we’ve discovered lines convey meaning more intuitively when weighted instead of being colored.
This is especially useful in large graphs, where lines can hide other lines and get lost in the tangle. Line weights are natural and intuitive. Think of cable, rope, twine, string, and thread. Just the sound of those linear objects conveys strength. Cables pull barges, ropes rope cows, twine bales hay, string wraps packages, and threads? Well a thread is what I’m hanging by with this metaphor.
But just look at the image below, over 200,000 lines of code are represented by this graph of code modules, what’s important, what’s not? Let’s add some weights to those lines.
Here’s a zoom-in of the same image. Here we’ve made four types of lines; the weakest are dotted lines, the threads. Then we move all the way to our ropes and cables. The point is now we can see the most important cloned code.
Our Visual Intelligence Explorer is taking shape very quickly. Please check back here, soon I’ll be posting about using the text search engine Lucene to find legacy source code signatures.