Research

  • Research
  • Measuring cyclomatic complexity of source code using machine learning.
Artificial Intelligence

Measuring cyclomatic complexity of source code using machine learning.

Apr 01, 2024

DOI: https://doi.org/10.18280/ria.380118

Published in: Revue d'Intelligence Artificielle

Publisher: Revue d'Intelligence Artificielle

/ Ayman Odeh Munther Odeh Hussein Odeh Nada Odeh

High-performance, high-quality software is a fundamental goal for all developers. To achieve this, software needs to be built with exceptional quality, featuring a simplified structure, strong coherence, and minimized complexity. Cyclomatic Complexity (CC), critical software metric, quantifies the intricacy of a program's structure and control flow. Traditionally, CC measurement has relied on laborious manual techniques or conventional programming methods, both prone to errors and inefficiency. To overcome these limitations, we present a revolutionary approach that leverages a Multinomial Naive Bayes (MNB) machine learning (ML) algorithm for automated CC measurement. This innovative method offers a more accurate, efficient, and reliable means of software complexity evaluation. Our study utilizes a vast dataset of 3,598 carefully curated programming samples from diverse programming projects across three popular languages: Java, Python, and C++. Training our MNB model on this comprehensive and diverse dataset yielded an outstanding overall accuracy of 97.3%, demonstrating the efficacy and reliability of our approach for CC measurement across different programming languages (PLs). This success can be attributed to the utilization of the NBM learning algorithm, known for its proficiency in classification tasks. Additionally, our study benefits from a larger and more diverse dataset compared to prior research, potentially contributing to the superior results. Our novel approach to CC measurement using machine learning holds significant promise for the development of more accurate and reliable code complexity assessment tools. These encouraging findings suggest that this approach has the potential to shape more effective software development practices in the future.

Other Researches

Copyright © 2024 Al Ain University. All Rights Reserved.