We can assess the quality of code to reduce the probability that software leads to unwanted behaviour and faults. In recent years, object-oriented programming (OOP) languages have adopted many features of the functional programming (FP) paradigm. We call the combination of these programming paradigms multi-paradigm (MP). Many tools have been built that measure code quality specifically for one MP programming language, but a large heterogeneous data set capturing important paradigm concepts, or the combination thereof, was lacking for each language. We hypothesise that we can create a language-agnostic representation of MP programming languages that can capture paradigm concepts and constructs. As a result, the language-agnostic representation can be used to reach a larger potential data set of usable projects.
To find the correct properties to create a language-agnostic representation of MP programming languages, we analyse paradigm constructs present in Java, C#, Kotlin and Scala. Using the Goal Question Metric approach, we create a mapping between code quality characteristics and code quality metrics. Using the analysis of selected MP programming languages and a set of code quality metrics, we design a language-agnostic representation of MP programming languages, namely, the LAMP metamodel. Using the metamodel, we created a framework for transforming MP programming languages to the LAMP metamodel and computing metrics on this language-agnostic representation. To evaluate the correctness and completeness of the LAMP metamodel, we evaluate how each metric can be computed using the metamodel representation. We have developed a prototype of our framework that can transform a Java project’s source code into a language-agnostic representation.
To evaluate the accuracy of our framework prototype, we compared metric computations of our prototype with two benchmarks of five Java projects.
From our evaluation, we conclude that our LAMP metamodel is capable of capturing the most important constructs of MP programming languages, and our framework is able to put forward a consistent workflow to assure code quality. Therefore, we argue that our framework design represents a significant step towards solving the data scarcity problem with fault proneness detection in MP programming languages.