The Impact of Mutability on Cyclomatic Complexity in Java

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Bagaev, Marat, Khabibrakhmanova, Alisa, Sabaev, Georgy, Bugayenko, Yegor
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866914971601862656
author Bagaev, Marat
Khabibrakhmanova, Alisa
Sabaev, Georgy
Bugayenko, Yegor
author_facet Bagaev, Marat
Khabibrakhmanova, Alisa
Sabaev, Georgy
Bugayenko, Yegor
contents In Java, some object attributes are mutable, while others are immutable (with the "final" modifier attached to them). Objects that have at least one mutable attribute may be referred to as "mutable" objects. We suspect that mutable objects have higher McCabe's Cyclomatic Complexity (CC) than immutable ones. To validate this intuition, we analysed 862,446 Java files from 1,000 open-GitHub repositories. Our results demonstrated that immutable objects are almost three times less complex than mutable ones. It can be therefore assumed that using more immutable classes could reduce the overall complexity and maintainability of the code base.
format Preprint
id arxiv_https___arxiv_org_abs_2410_10425
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle The Impact of Mutability on Cyclomatic Complexity in Java
Bagaev, Marat
Khabibrakhmanova, Alisa
Sabaev, Georgy
Bugayenko, Yegor
Software Engineering
In Java, some object attributes are mutable, while others are immutable (with the "final" modifier attached to them). Objects that have at least one mutable attribute may be referred to as "mutable" objects. We suspect that mutable objects have higher McCabe's Cyclomatic Complexity (CC) than immutable ones. To validate this intuition, we analysed 862,446 Java files from 1,000 open-GitHub repositories. Our results demonstrated that immutable objects are almost three times less complex than mutable ones. It can be therefore assumed that using more immutable classes could reduce the overall complexity and maintainability of the code base.
title The Impact of Mutability on Cyclomatic Complexity in Java
topic Software Engineering
url https://arxiv.org/abs/2410.10425