Metrics for Aspect-Oriented Programming of middleware systems
MetadataShow full item record
In this diploma thesis we have aimed to identify metrics that accommodate two chosen system quality factors and implementing the selected metrics in a metrics tool. The metrics chosen should measure change in the system quality factors reusability and maintainability for the middleware system COS at Telenor Mobile and similar systems. The metrics tool should support the aspect-oriented programming language AspectJ, and is planned to be a plugin to the open source code analysis framework XRadar. Changes due to introduction of aspects are of particular interest. We have through a GQM process identified the following subcharacteristics for the chosen system quality factors: modularity, testability, analyzability, changeability and stability. Questions are formulated to analyze these sub factors, and metrics that can answer the questions are chosen. We have implemented the tool AspectMetrics, which calculate metrics on Java and AspectJ code and generates an XML report containing the measurement results. A transformation from XML to HTML web pages is also provided. The metrics tool can measure size metrics, like the number of statements and the number of classes, coupling, fan-in/fan-out, cohesion and advice-in/advice-out. Advice-in and advice-out are two new metrics which respectively measures how many advice a class (or aspect) is affected by and how many joinpoints an advice hits on. These metrics are inspired by the concept for the fan-in and fan-out metrics. The tool has been used to analyze two versions of the system DIAS v.2.0, which is a part of a diploma study in 2000. We have in our preparation project in 2003 added aspects to the DIAS system while keeping the system functionally equal to the original version. We have used our metrics tool to calculate the differences between the system with and the system without aspects. The introduction of aspects gave a positive change in coupling, fan-in/fan-out and size measures, while cohesion was negatively affected. The metrics thus, overall, indicated a positive change to the subcharacteristics testability, analyzability, changeability and stability and both the main quality factors. There was no indication of a positive change to modularity. The analysis of the measurement results indicates that most of the metrics perform as intended. The size metrics, coupling, fan-in/fan-out, and advice-in/advice-out all gave results that corresponded to what we had expected. However, the cohesion measure did not behave in a way that could be correlated to the actual changes performed on the code. A closer analysis showed that moving and merging of functionality could result in either an increase or a decrease in cohesion. Thus we find that cohesion, at least in its current form, is not a suitable metric when using aspect-oriented programming. Further, this gave reason to reinvestigate the disappointing modularity results. With a reworked set of criteria we also found indication of improved modularity.