arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2601.21565cs.SEcs.CL
收藏

多目标整数线性规划方法用于自动软件认知复杂度降低

Multi-objective Integer Linear Programming approach for Automatic Software Cognitive Complexity Reduction

University of Málaga(马拉加大学);Ayesa Advanced Digital Services Limited (ASDA)(阿耶萨高级数字服务有限公司)

Adriana Novoa-Hurtado, Rubén Saborido, Francisco Chicano, Manuel Giménez-Medina

AI总结:

本文提出多目标整数线性规划方法,用于自动降低软件的认知复杂度,通过平衡代码行数与复杂度来提升代码可维护性。

摘要:

清晰简洁的代码是确保可维护性的必要条件,因此软件应尽可能简单易懂,以避免bug和最关键的是漏洞。有许多方法可以在不改变软件功能的情况下提高软件质量,考虑提取方法重构主要过程以减少代码理解所需的努力。本工作中采用的认知复杂度度量是SonarSource公司定义的,该公司开发了知名的静态代码分析应用。该提取问题可以建模为一个组合优化问题。主要困难在于评估所获得解决方案的不同标准的存在,需要使用替代方法将代码提取问题建模为多目标优化问题。我们提出了一种多目标整数线性规划模型,以获得一组减少给定代码认知复杂度的解决方案,例如平衡代码行数和其认知复杂度。此外,已经开发了几种算法来验证该模型。这些算法已被集成到一个工具中,该工具能够实现参数化解决降低软件认知复杂度问题。

英文摘要:

Clear and concise code is necessary to ensure maintainability, so it is crucial that the software is as simple as possible to understand, to avoid bugs and, above all, vulnerabilities. There are many ways to enhance software without changing its functionality, considering the extract method refactoring the primary process to reduce the effort required for code comprehension. The cognitive complexity measure employed in this work is the one defined by SonarSource, which is a company that develops well-known applications for static code analysis. This extraction problem can be modeled as a combinatorial optimization problem. The main difficulty arises from the existence of different criteria for evaluating the solutions obtained, requiring the formulation of the code extraction problem as a multi-objective optimization problem using alternative methods. We propose a multi-objective integer linear programming model to obtain a set of solutions that reduce the cognitive complexity of a given piece of code, such as balancing the number of lines of code and its cognitive complexity. In addition, several algorithms have been developed to validate the model. These algorithms have been integrated into a tool that enables the parameterised resolution of the problem of reducing software cognitive complexity.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑