Measuring Complexity in X++ Code



AbstractAlmost from the beginning of software development there has been a wish of being able to measure the quality of the program code. One aspect that affects several areas of software quality is the complexity of the code. Limiting the code complexity can lead to more testable code, provides faster bug-fixing and makes it easier to implement new features. The purpose of this project has been to find and implement relevant complexity metrics for the programming language X++, which is a part of the Microsoft Dynamics AX ERP system.

After some investigation the following ten metrics were selected: Source Lines Of Code, Comment Percentage, Cyclomatic Complexity, Weighted Methods per Class, Depth of Inheritance Tree, Number Of Children, Coupling Between Objects, Response For Class, Lack of Cohesion in Methods and Fan In. They represent some of the most established measures available and are a combination of traditional metrics and metrics designed specifically for object-oriented languages.

Each of the chosen metrics was implemented as stipulated in the theory. Since X++ contains special language features (e.g. embedded SQL) that the original authors did not describe, it was necessary to find out what the original intend of the metric was, an then derive a reasonable solution.

The metrics has been integrated into the existing Best Practice tool, which allows developers to check that their code adheres to certain non-syntax rules. This way they can immediately determine if the complexity values of their code is outside acceptable ranges and hence may need changes to reduce complexity.

In addition to the Best Practice checks, the metric values can be extracted as raw data for statistical purposes. It is also possible to directly generate statistics on a team/module level.
TypeBachelor thesis [Industrial collaboration]
Year2006
PublisherInformatics and Mathematical Modelling, Technical University of Denmark, DTU
AddressRichard Petersens Plads, Building 321, DK-2800 Kgs. Lyngby
SeriesIMM-B.Eng-2006-42
NoteSupervised by Knud Smed Christensen, IMM.
Electronic version(s)[pdf]
BibTeX data [bibtex]
IMM Group(s)Computer Science & Engineering