arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2101.00090cs.SE
收藏

Web应用中的PHP代码异味:生存与异常

PHP code smells in web apps: survival and anomalies

Iscte - Instituto Universitário de Lisboa, ISTAR(里斯本大学学院);NOVAIMS, UNL(新里斯本大学管理信息系统研究所)

Américo Rio, Fernando Brito e Abreu

AI总结:

本文对PHP Web应用中代码异味的生存与异常进行了纵向研究,发现异味生存期取决于其范围(局部约4年,分散约5年),约60%被移除,并证明异常图形化能揭示项目历史以督促定期重构。

摘要:

背景:代码异味被认为是糟糕设计的症状,会导致未来的问题,例如可维护性降低。除了轶事案例(例如代码丢失)外,代码异味会一直存在,直到被显式重构或移除。本文针对使用PHP构建的Web应用中的代码异味生存问题进行了一项纵向研究。目标:研究问题:(i) 代码异味的生存是否取决于其范围?(ii) 从业者对Web应用中移除代码异味的态度是否随时间发生了改变?(iii) 代码异味在Web应用中能存活多久?(iv) 在Web应用的演化过程中,代码异味的密度是否存在突然变化(异常)?方法:我们使用生存分析技术,分析了服务端用PHP编写的8个Web应用中6种代码异味在数年间的演化。我们根据范围将代码异味分为两类:分散型和局部型。分散型代码异味预计危害更大,因为其影响不像局部型代码异味那样受限。我们将每个Web应用的观察结果分成两个相等且连续的时间段,以测试代码异味意识随时间增强的假设。对于异常,我们标准化了其检测标准。结果:我们提供了一些证据表明代码异味的生存取决于其范围:部分异味的平均生存率下降,而其余异味则观察到相反的情况。局部型代码异味的生存期约为4年,而分散型约为5年。大约60%的异味被移除,部分异味贯穿应用整个生命周期。我们还展示了如何通过代码异味演化中异常的图形表示,揭示开发项目的故事,并使管理者意识到需要推行定期重构实践。

英文摘要:

Context: Code smells are considered symptoms of poor design, leading to future problems, such as reduced maintainability. Except for anecdotal cases (e. g. code dropout), a code smell survives until it gets explicitly refactored or removed. This paper presents a longitudinal study on the survival of code smells for web apps built with PHP. Objectives: RQ: (i) code smells survival depends on their scope? (ii) practitioners attitudes towards code smells removal in web apps have changed throughout time? (iii) how long code smells survive in web applications? (iv) are there sudden variations (anomalies) in the density of code smells through the evolution of web apps? Method: We analyze the evolution of 6 code smells in 8 web applications written in PHP at the server side, across several years, using the survival analysis technique. We classify code smells according to scope in two categories: scattered and localized. Scattered code smells are expected to be more harmful since their influence is not circumscribed as in localized code smells. We split the observations for each web app into two equal and consecutive timeframes, to test the hypothesis that code smells awareness has increased throughout time. As for the anomalies, we standardize their detection criteria. Results: We present some evidence that code smells survival depends on their scope: the average survival rate decreases in some of them, while the opposite is observed for the remainder. The survival of localized code smells is around 4 years, while the scattered ones live around 5 years. Around 60% of the smells are removed, and some live through all the application life. We also show how a graphical representation of anomalies found in the evolution of code smells allows unveiling the story of a development project and make managers aware of the need for enforcing regular refactoring practices.

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

↑