arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2410.05683cs.SE
收藏

熟练编写的代码可维护性如何?针对三个PyPI库的案例研究

How Maintainable is Proficient Code? A Case Study of Three PyPI Libraries

Indira Febriyanti, Youmei Fan, Kazumasa Shimari, Kenichi Matsumoto, Raula Gaikovina Kula

AI总结:

本研究针对三个PyPI库的3003个文件开展探索性分析,探究Python代码熟练度与可维护性的关系,发现多数熟练代码维护风险低,但部分熟练写法存在高风险,可帮助开发者规避相关维护问题。

摘要:

Python因适用开发者、数据科学家、机器学习专家等更广泛人群而十分流行。与其他编程语言一样,Python代码的编写水平也有从入门到高级的层级划分。但和所有软件一样,随着漏洞出现以及新功能需求产生,代码需要持续维护。尽管Python之禅提出“简单胜于复杂”,我们提出假设:更优雅、更熟练编写的代码可能更难让开发者维护。为研究代码可维护性认知与代码熟练度之间的关系,我们针对三个Python库的代码复杂度开展了一项探索性研究,具体探究了文件内熟练代码的风险等级。作为研究起点,我们挖掘并收集了三个PyPI库共3003个文件的代码熟练度数据,识别出若干高熟练度且高风险的代码实例,例如简单列表推导式、enumerate调用、生成器表达式、简单字典推导式以及super函数。我们的初步案例显示,大多数熟练编写的代码可维护性风险较低,但仍存在部分熟练代码同样会给维护带来风险的情况。我们预计该研究将帮助开发者识别在何种场景、何时使用熟练编写的代码可能会对未来的代码维护工作产生不利影响。

英文摘要:

Python is very popular because it can be used for a wider audience of developers, data scientists, machine learning experts and so on. Like other programming languages, there are beginner to advanced levels of writing Python code. However, like all software, code constantly needs to be maintained as bugs and the need for new features emerge. Although the Zen of Python states that "Simple is better than complex," we hypothesize that more elegant and proficient code might be harder for the developer to maintain. To study this relationship between the understanding of code maintainability and code proficiency, we present an exploratory study into the complexity of Python code on three Python libraries. Specifically, we investigate the risk level of proficient code inside a file. As a starting point, we mined and collected the proficiency of code from three PyPI libraries totaling 3,003 files. We identified several instances of high proficient code that was also high risk, with examples being simple list comprehensions, 'enumerate' calls, generator expressions, simple dictionary comprehensions, and the 'super' function. Our early examples revealed that most code-proficient development presented a low maintainability risk, yet there are some cases where proficient code is also risky to maintenance. We envision that the study should help developers identify scenarios where and when using proficient code might be detrimental to future code maintenance activities.

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

↑