On the Importance and Shortcomings of Code Readability Metrics: A Case Study on Reactive Programming

10/28/2021
by   Gustaf Holst, et al.
0

Well structured and readable source code is a pre-requisite for maintainable software and successful collaboration among developers. Static analysis enables the automated extraction of code complexity and readability metrics which can be leveraged to highlight potential improvements in code to both attain software of high quality and reinforce good practices for developers as an educational tool. This assumes reliable readability metrics which are not trivial to obtain since code readability is somewhat subjective. Recent research has resulted in increasingly sophisticated models for predicting readability as perceived by humans primarily with a procedural and object oriented focus, while functional and declarative languages and language extensions advance as they often are said to lead to more concise and readable code. In this paper, we investigate whether the existing complexity and readability metrics reflect that wisdom or whether the notion of readability and its constituents requires overhaul in the light of programming language changes. We therefore compare traditional object oriented and reactive programming in terms of code complexity and readability in a case study. Reactive programming is claimed to increase code quality but few studies have substantiated these claims empirically. We refactored an object oriented open source project into a reactive candidate and compare readability with the original using cyclomatic complexity and two state-of-the-art readability metrics. More elaborate investigations are required, but our findings suggest that both cyclomatic complexity and readability decrease significantly at the same time in the reactive candidate, which seems counter-intuitive. We exemplify and substantiate why readability metrics may require adjustment to better suit popular programming styles other than imperative and object-oriented to better match human expectations.

READ FULL TEXT

page 1

page 8

research
08/28/2020

Smoothly Navigating between Functional Reactive Programming and Actors

We formally define an elegant multi-paradigm unification of Functional R...
research
09/08/2021

On the differences between quality increasing and other changes in open source Java projects

Static software metrics, e.g., size, complexity and coupling are used in...
research
01/05/2021

Why Developers Refactor Source Code: A Mining-based Study

Refactoring aims at improving code non-functional attributes without mod...
research
11/08/2019

ROSY: An elegant language to teach the pure reactive nature of robot programming

Robotics is incredibly fun and is long recognized as a great way to teac...
research
11/23/2020

Simulating an Object-Oriented Financial System in a Functional Language

This paper summarises a successful application of functional programming...
research
11/04/2019

Learning based Methods for Code Runtime Complexity Prediction

Predicting the runtime complexity of a programming code is an arduous ta...
research
04/12/2023

Programming Language Assisted Waveform Analysis: A Case Study on the Instruction Performance of SERV

RISC-Vs growing traction leads to the release of new RISC-V cores on a n...

Please sign up or login with your details

Forgot password? Click here to reset