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.


翻译:清晰简洁的代码是保证可维护性的必要条件,因此软件应尽可能易于理解,以避免缺陷,尤其是安全漏洞。在不改变功能的前提下,可通过多种方式优化软件,其中提取方法重构是降低代码理解成本的主要手段。本研究采用的认知复杂度度量标准由静态代码分析领域知名开发商SonarSource定义。该提取问题可建模为组合优化问题,其主要难点在于存在多种评估解决方案的准则,需要采用替代方法将代码提取问题构建为多目标优化问题。我们提出了一种多目标整数线性规划模型,用于获取能降低给定代码段认知复杂度的解决方案集合,例如平衡代码行数与认知复杂度。此外,本研究开发了多种算法以验证模型有效性,并将这些算法集成至工具中,实现了软件认知复杂度降低问题的参数化求解。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
《基于大型语言模型的软件工程自动化研究》最新264页
专知会员服务
37+阅读 · 2025年7月14日
《深度学习代码智能》综述、基准和工具集
专知会员服务
56+阅读 · 2024年1月2日
【Manning新书】面向数据编程:减少软件复杂度,426页pdf
专知会员服务
81+阅读 · 2022年7月20日
专知会员服务
37+阅读 · 2021年10月16日
专知会员服务
14+阅读 · 2021年9月21日
专知会员服务
16+阅读 · 2021年1月23日
【2020新书】如何认真写好的代码和软件,318页pdf
专知会员服务
66+阅读 · 2020年3月26日
《代码整洁之道》:5大基本要点
专知会员服务
50+阅读 · 2020年3月3日
简述多种降维算法
算法与数学之美
11+阅读 · 2018年9月23日
《软件方法》1-8章全部自测题更新内容
UMLChina
11+阅读 · 2018年3月26日
【干货】深入理解自编码器(附代码实现)
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关VIP内容
《基于大型语言模型的软件工程自动化研究》最新264页
专知会员服务
37+阅读 · 2025年7月14日
《深度学习代码智能》综述、基准和工具集
专知会员服务
56+阅读 · 2024年1月2日
【Manning新书】面向数据编程:减少软件复杂度,426页pdf
专知会员服务
81+阅读 · 2022年7月20日
专知会员服务
37+阅读 · 2021年10月16日
专知会员服务
14+阅读 · 2021年9月21日
专知会员服务
16+阅读 · 2021年1月23日
【2020新书】如何认真写好的代码和软件,318页pdf
专知会员服务
66+阅读 · 2020年3月26日
《代码整洁之道》:5大基本要点
专知会员服务
50+阅读 · 2020年3月3日
相关基金
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员