Deprecated: Function split() is deprecated in /home/content/s/w/a/swatadmin/html/cswat/templates/ja_bellatrix/index.php on line 12
CodeSWAT.COM - Categorizing Code Using Software Metrics Skip to content

Deprecated: Assigning the return value of new by reference is deprecated in /home/content/s/w/a/swatadmin/html/cswat/templates/ja_bellatrix/ja_cssmenu/ja-cssmenu.php on line 73

Narrow screen resolution Wide screen resolution Auto adjust screen size Increase font size Decrease font size Default font size default color brick color green color
You are here:Home arrow Analyst4j arrow Categorizing Code
Categorizing Code Using Software Metrics Print E-mail

Categorizing Code Using Software Metrics

In general categorizing or stereotyping things, places or objects enables us to imagine common properties of a thing by just referring to the category. In way categorization helps to predict what can be expected from a category of objects, and prediction helps us in planning.

So, categorizing code using metrics or quality attributes of code would help us predict and plan no matter if the project is in development, maintenance,  open source or bought out.  For eg. categorizing files based on their "Maintainability Index" metric would help us predict the future maintainability of the system.

Analys4j's automated software metrics, graphs and categorization interface helps you to categorize code based on metrics.(List of metrics)

Lets study this using 'SEI Maintainability Index'

SEI Maintainability Index Metric, is being widely use to understand the maintainability by analyzing the source code. Analyst4j automates the measurement of MI.  Though categorization is useful, the thresholds which are used to categorize is of prime importance because we intend to make important decision based on these categorization.  Metrics threshold can be set using empirical methods or well citied research works. Empirical methods could be time consuming, Analyst4j saves time by sourcing the metrics and providing an environment to find,visualize and analyze software metrics. A quicker methods to find a threshold for a metric would be adopt other research works carried on the metric in concern. For eg. In a major research effort due to Hewlett Packard, the following thresholds for the evaluation of the maintainability index, calculated by means of the previous models, have been determined:

  • MI < 65            poor maintainability
  • 65 < MI < 85   fair maintainability
  • 85 < MI           excellent maintainability

Reference: http://www.stsc.hill.af.mil/crosstalk/2001/08/liso.html

Categorizing MI using the above thresholds with Analyst4j.

JFreechart is a well maintained free charting component written using Java, infact Analyst4j uses JFreechart for visualizing metrics distribution, comparison  and analysis.

Analysis report of two version of JFreechart source

  • 1.) JFreechart-1.0.0-Pre1 (Pre release)
  • 2.) JFreechart-1.0.1

JFreechart MI

 Categorized results and Comparison

  Analyzed(*) Time(+)Very PoorPoor
Fair
 Excellent
JFreechart-1.0.0-pre1 452/662316sec
 6 49 67 330
JFreechart-1.0.1469/738366sec
 6
 56
 73
 334

(*)junit testing packages/files were excluded. (+) On Pentium IV, 2.66 G Hz, 512 MB Ram

It can be conclude that JFreechart seems to have excellent maintainability, and improvements(changes) does not deter the maintainability. However the following cases has to be in safe hands during changes and improvement.

Very Poor Maintainability [ MI <=0 ]

 

 

Case

MI_FIL [1.0.0-pre1]

MI_FIL[1.0.1]

Observation

XYPlot.java

-80.165796

-90.533254

 

CategoryPlot.java

-44.202404

-58.70837

 

AbstractRenderer.java

-24.71897

-29.939237

 

ChartPanel.java

-5.449186

-15.046721

 

PiePlot.java

-1.778467

-6.337124

 

DatasetUtilities.java

-30.99173

-2.520924

 

The above was prepared using "Copy to Clipboard" option, in QA Cases View of Analyst4j.

 
< Prev   Next >