Cargando…
Evaluation of Rust code verbosity, understandability and complexity
Rust is an innovative programming language initially implemented by Mozilla, developed to ensure high performance, reliability, and productivity. The final purpose of this study consists of applying a set of common static software metrics to programs written in Rust to assess the verbosity, understa...
Autores principales: | , , , |
---|---|
Formato: | Online Artículo Texto |
Lenguaje: | English |
Publicado: |
PeerJ Inc.
2021
|
Materias: | |
Acceso en línea: | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7959618/ https://www.ncbi.nlm.nih.gov/pubmed/33817049 http://dx.doi.org/10.7717/peerj-cs.406 |
_version_ | 1783664988664102912 |
---|---|
author | Ardito, Luca Barbato, Luca Coppola, Riccardo Valsesia, Michele |
author_facet | Ardito, Luca Barbato, Luca Coppola, Riccardo Valsesia, Michele |
author_sort | Ardito, Luca |
collection | PubMed |
description | Rust is an innovative programming language initially implemented by Mozilla, developed to ensure high performance, reliability, and productivity. The final purpose of this study consists of applying a set of common static software metrics to programs written in Rust to assess the verbosity, understandability, organization, complexity, and maintainability of the language. To that extent, nine different implementations of algorithms available in different languages were selected. We computed a set of metrics for Rust, comparing them with the ones obtained from C and a set of object-oriented languages: C++, Python, JavaScript, TypeScript. To parse the software artifacts and compute the metrics, it was leveraged a tool called rust-code-analysis that was extended with a software module, written in Python, with the aim of uniforming and comparing the results. The Rust code had an average verbosity in terms of the raw size of the code. It exposed the most structured source organization in terms of the number of methods. Rust code had a better Cyclomatic Complexity, Halstead Metrics, and Maintainability Indexes than C and C++ but performed worse than the other considered object-oriented languages. Lastly, the Rust code exhibited the lowest COGNITIVE complexity of all languages. The collected measures prove that the Rust language has average complexity and maintainability compared to a set of popular languages. It is more easily maintainable and less complex than the C and C++ languages, which can be considered syntactically similar. These results, paired with the memory safety and safe concurrency characteristics of the language, can encourage wider adoption of the language of Rust in substitution of the C language in both the open-source and industrial environments. |
format | Online Article Text |
id | pubmed-7959618 |
institution | National Center for Biotechnology Information |
language | English |
publishDate | 2021 |
publisher | PeerJ Inc. |
record_format | MEDLINE/PubMed |
spelling | pubmed-79596182021-04-02 Evaluation of Rust code verbosity, understandability and complexity Ardito, Luca Barbato, Luca Coppola, Riccardo Valsesia, Michele PeerJ Comput Sci Software Engineering Rust is an innovative programming language initially implemented by Mozilla, developed to ensure high performance, reliability, and productivity. The final purpose of this study consists of applying a set of common static software metrics to programs written in Rust to assess the verbosity, understandability, organization, complexity, and maintainability of the language. To that extent, nine different implementations of algorithms available in different languages were selected. We computed a set of metrics for Rust, comparing them with the ones obtained from C and a set of object-oriented languages: C++, Python, JavaScript, TypeScript. To parse the software artifacts and compute the metrics, it was leveraged a tool called rust-code-analysis that was extended with a software module, written in Python, with the aim of uniforming and comparing the results. The Rust code had an average verbosity in terms of the raw size of the code. It exposed the most structured source organization in terms of the number of methods. Rust code had a better Cyclomatic Complexity, Halstead Metrics, and Maintainability Indexes than C and C++ but performed worse than the other considered object-oriented languages. Lastly, the Rust code exhibited the lowest COGNITIVE complexity of all languages. The collected measures prove that the Rust language has average complexity and maintainability compared to a set of popular languages. It is more easily maintainable and less complex than the C and C++ languages, which can be considered syntactically similar. These results, paired with the memory safety and safe concurrency characteristics of the language, can encourage wider adoption of the language of Rust in substitution of the C language in both the open-source and industrial environments. PeerJ Inc. 2021-02-26 /pmc/articles/PMC7959618/ /pubmed/33817049 http://dx.doi.org/10.7717/peerj-cs.406 Text en © 2021 Ardito et al. https://creativecommons.org/licenses/by/4.0/ This is an open access article distributed under the terms of the Creative Commons Attribution License (https://creativecommons.org/licenses/by/4.0/) , which permits unrestricted use, distribution, reproduction and adaptation in any medium and for any purpose provided that it is properly attributed. For attribution, the original author(s), title, publication source (PeerJ Computer Science) and either DOI or URL of the article must be cited. |
spellingShingle | Software Engineering Ardito, Luca Barbato, Luca Coppola, Riccardo Valsesia, Michele Evaluation of Rust code verbosity, understandability and complexity |
title | Evaluation of Rust code verbosity, understandability and complexity |
title_full | Evaluation of Rust code verbosity, understandability and complexity |
title_fullStr | Evaluation of Rust code verbosity, understandability and complexity |
title_full_unstemmed | Evaluation of Rust code verbosity, understandability and complexity |
title_short | Evaluation of Rust code verbosity, understandability and complexity |
title_sort | evaluation of rust code verbosity, understandability and complexity |
topic | Software Engineering |
url | https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7959618/ https://www.ncbi.nlm.nih.gov/pubmed/33817049 http://dx.doi.org/10.7717/peerj-cs.406 |
work_keys_str_mv | AT arditoluca evaluationofrustcodeverbosityunderstandabilityandcomplexity AT barbatoluca evaluationofrustcodeverbosityunderstandabilityandcomplexity AT coppolariccardo evaluationofrustcodeverbosityunderstandabilityandcomplexity AT valsesiamichele evaluationofrustcodeverbosityunderstandabilityandcomplexity |