292x Filetype PDF File size 0.43 MB Source: research.infosupport.com
Code Quality Evaluation for the
Multi-Paradigm Programming
Language Scala
Erik Landkroon
eriklandkroon@gmail.com
August 18, 2017, 65 pages
Host Supervisor: Rinse van Hees
Host organisation: Info Support, https://www.infosupport.com/
Academic supervisor: Clemens Grelck
Universiteit van Amsterdam
Faculteit der Natuurwetenschappen, Wiskunde en Informatica
Master Software Engineering
http://www.software-engineering-amsterdam.nl
Contents
Abstract 3
1 Introduction 4
2 The Multi-Paradigm Language Scala 6
2.1 General language design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Mutable and Immutable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Nested functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 Recursion and tail recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.5 Higher-order function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.6 Anonymous functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.7 Currying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.8 Classes, Objects and Traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.9 Pattern matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3 Code Metrics 10
3.1 Software Code Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2 Metric Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3 General Code Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.4 Object-Oriented Code Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.5 Functional Code Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4 Briand’s Validation Methodology 14
4.1 Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.2 Logistic regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.3 Step-wise selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.4 Model evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.5 Model validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5 Our Validation Methodology 18
5.1 Critique of Briand’s Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.2 New validation method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6 Realization of the validation framework 21
6.1 Code Metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.2 Code analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.3 Bug collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.4 Data Collection - Briand’s Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.5 Data Collection - Our Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6.6 Data analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
7 Empirical Validation Using Briand’s Validation Methodology 30
7.1 Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
7.2 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
7.3 Gitbucket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1
7.4 Shadowshock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
7.5 Akka Http Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
7.6 Threat to validity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
8 Empirical Validation Using Our Validation Methodology 39
8.1 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
8.2 Akka Http Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
8.3 Gitbucket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
8.4 Shadowshock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
8.5 Threat to validity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
9 Related work 45
10 Conclusion 47
Bibliography 49
A Results 51
A.1 Gitbucket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
A.2 Shadowshock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
A.3 HTTP Akka . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
2
Abstract
Code metrics are used to measure properties of the source code. Using these measurements, estima-
tions / statements can be made about the maintainability, fault-proneness and quality of the code.
Code metrics are often designed for a specific programming paradigm. Metrics suites have been
presented and validated for both the object-oriented and for the functional programming paradigm.
However, Scala combines both the object-oriented and the functional programming paradigm. There-
fore, we cannot assume, without proper validation, that there is a significant relation between the
metrics and the code quality.
In this study, we investigate a relation between the fault-proneness of classes and the code metrics
of an object-oriented and functional metric suite, as well as some general code metrics. We present an
implementation, for each of the metrics selected for our research, for the Scala programming language.
Wepresent some Scala specific code metrics as well. Furthermore, we present our own novel improved
validation methodology, based on an existing validation methodology.
Ourresults suggest that our validation methodology has an overall higher performance (up to more
than a two-fold increase in completeness), especially for projects with longer life-cycles, compared to
the existing methodology. Furthermore, the results suggest that there is a significant relation between
the fault-proneness of classes and most of the metrics.
3
no reviews yet
Please Login to review.