Code City

Yesterday, I visited an interesting presentation from Tudor Girba. He showed us several ways for visualize code. One of the most interesting visualization was Code City.

 

image

(ArgoUML from http://moose.unibe.ch/tools/codecity)

 

I couldn’t wait to visualize our current software project. First of all, you have to create a MSE file of your code. The MSE file as a generic file of your source code. This is done with iPlasma, as described here http://moose.unibe.ch/news/iplasma-to-moose-screencast.

 

After you have created an MSE file, you can now visualize your code with Code City. Just download it from http://www.inf.unisi.ch/phd/wettel/codecity.html, run it, import the MSE file and create your city. Enjoy!

 

For better code analysis, I changed the configuration of the “buildings” in my city. I changed the width and length of class element …

image

… to a linear mapper based on the lines of code.

image

 

Code City is very helpful to compare different parts of the application and to just visualize the software!

About the author

stefan.jaeger

6 comments

  • Looks cool. Did you get some useful information about your code out of the visualization?

  • All the metrics calculated for this diagram can also be gathered with other tools. But Code City helps you to put the metrics in a visual relation. For example, the lines of code in relation to numbers of methods isn’t just a number, it’s now a building. And the “map” of the city is the package structure. On the map you can see directly, in which packages (or regions on the map) accumulation of big buildings are.

    We also used Code City to create a color gradient on specific metrics (a simple example: numbers of classes in a package). Red areas had a lot of classes inside the package and green areas we’re almost empty. This city doesn’t say, that a lot of classes inside a package are good or bad. But it shows, where in your software big packages are and where small packages are. Perhaps, it shouldn’t be that way and you can refactor it. Perhaps it’s okay, and you just let the code as it was before.

    Last but no least, with Code City you can track very easily your code. It’s possible to create a “Evolution”. For example, you can create one city for each artefact after an iteration. Then you can see, which reagions of your city are growing or which areas are mostly affected by an iteration cycle.

  • I am unable to create MSE files from the links in the article. They are broken. Any other way to get my MSE file?

By stefan.jaeger

Recent Posts