City Model – New release

Do you remember that I got a nice Christmas gift?

It was the Sonar plugin City Model made by eXcentia and they have released a new version. This will let us the opportunity to show how to customize your own dashboard with Sonar.

This is what looks my application after I installed the plugin. Remember you can go in every three directions using your mouse, to turn the ‘City’ horizontally, vertically, or to get closer or away.

The installation of the plugin is quite easy: you download it and save it into the directory ‘\extensions\plugins’ of Sonar. Then you stop/start Sonar to be able to use it.

In order to get the ‘City’ into your dashboard, you login as an administrator so that when you select one project and display its dashboard, you now have a menu that allows you to personalize it.

Let’s click on ‘Configure widgets’ to display the list of all the widgets to customize your dashboard. Here is the one to add the City Model. Just click on ‘Add widget’ to get a city representing your application.

Now, with the plugin of eXcentia comes another widget – City Model Top – that lists a determined number of classes according to the value you choose. And I find that really useful.

When you meet a person for the first time, the first thing you look at is her size and you could get a pretty fine idea of it very easily. Same with an application, code size measured in LOC is a very easy measure to get, and this is the default value used when you add the City Model Top.

Then, you could try to evaluate the weight of this person or, for an application, its complexity. As it is not as easy to guess, you would probably have to ask this person in order to know its weight, as you need a code analysis tool to evaluate the Cyclomatic Complexity (CC) for an application.

In order to do that, you just have to add again a City Model Top widget and to change its parameters by clicking the ‘Edit’ button.

Here we have entered our own values:

  • A new title ‘Complexity’.
  • ‘topListLength’ = 5 to limit the display to the top five classes.
  • {complexity} to indicate that we want to list the most complex classes.

Click on ‘Save’ to see the results:

Once you get an idea of the size and the complexity of the top classes, you begin to get an idea of the application. You will now need some more complex measures. Well, you can imagine different formulas.

Here I have added a third widget to calculate the average CC per method using the following formula: {complexity}/{functions}.

And here it is:

What is really great with the Sonar dashboard is that you can dispose these widgets we have been adding exactly where you wan them just by selecting and drag-dropping them.

The button ‘Back to dashboard’ will save your choices and display your new customized dashboard.

Here is mine, with the ‘City’ on the left and three ‘top lists’ of the biggest, most complex classes on the right.

This allows you to assess quickly what are the most important numbers on any new application and get instantly the list of the classes to check. It helps you to define priorities to plan your tests, when someone introduces a change in one of these classes because they are the most difficult to understand and this is really easy to create new defects.

Great value. The City Model plugin comes with a moderate price and a two weeks evaluation licence.

Just experiment and enjoyed it.


Leave a Reply

Your email address will not be published. Required fields are marked *