To Type or Not to Type? A Systematic Comparison of the Software Quality of JavaScript and TypeScript Applications on GitHub

03/21/2022
by   Justus Bogner, et al.
0

JavaScript (JS) is one of the most popular programming languages, and widely used for web apps and even backend development. Due to its dynamic nature, however, JS applications often have a reputation for poor software quality. As a type-safe superset of JavaScript, TypeScript (TS) offers features to address this. However, there is currently insufficient empirical evidence to broadly support the claim that TS apps exhibit better software quality than JS apps. We therefore conducted a repository mining study based on 604 GitHub projects (299 for JS, 305 for TS) with over 16M LoC and collected four facets of software quality: a) code quality (# of code smells per LoC), b) code understandability (cognitive complexity per LoC), c) bug proneness (bug fix commit ratio), and d) bug resolution time (mean time a bug issue is open). For TS, we also collected how frequently the type-safety ignoring `any` type was used. The analysis indicates that TS apps exhibit significantly better code quality and understandability than JS apps. Contrary to expectations, however, bug proneness and bug resolution time of our TS sample were not significantly lower than for JS: mean bug fix commit ratio was more than 60 0.206), and TS projects needed on average more than an additional day to fix bugs (31.86 vs. 33.04 days). Furthermore, reducing the usage of the `any` type in TS apps was significantly correlated with all metrics except bug proneness (Spearman's rho between 0.17 and 0.26). Our results indicate that the perceived positive influence of TypeScript for avoiding bugs in comparison to JavaScript may be more complicated than assumed. While using TS seems to have benefits, it does not automatically lead to less and easier to fix bugs. However, more research is needed in this area, especially concerning the potential influence of project complexity and developer experience.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
01/18/2018

Enhancing Bug Reports for Mobile Apps

The modern software development landscape has seen a shift in focus towa...
research
04/03/2022

A Study of Single Statement Bugs Involving Dynamic Language Features

Dynamic language features are widely available in programming languages ...
research
01/07/2023

App Review Driven Collaborative Bug Finding

Software development teams generally welcome any effort to expose bugs i...
research
11/09/2018

Influence of Technical and Social Factors for Introducing Bugs

As the modern open-source paradigm makes it easier to contribute to soft...
research
08/09/2018

Safe Stream-Based Programming with Refinement Types

In stream-based programming, data sources are abstracted as a stream of ...
research
01/03/2018

How Does Bug-Handling Effort Differ Among Different Programming Languages?

Handling bugs is an essential part of software development. The impact o...

Please sign up or login with your details

Forgot password? Click here to reset