论文标题

认知驱动的发展在多大程度上提高了代码的可读性?

To What Extent Cognitive-Driven Development Improves Code Readability?

论文作者

Barbosa, Leonardo, Santiago, Victor Hugo, de Souza, Alberto Luiz Oliveira Tavares, Pinto, Gustavo

论文摘要

认知驱动的开发(CDD)是一种编码设计技术,旨在减少开发人员在理解给定代码单元(例如类别)中所付出的认知工作。通过遵循CDD设计实践,预计编码单元将较小,因此更容易维护和发展。但是,到目前为止,使用CDD标准编码的这些较小的代码单元是否确实更容易理解。在这项工作中,我们旨在评估哪些CDD提高代码可读性。为了实现这一目标,我们进行了两阶段的研究。首先,邀请专业软件开发人员对最可读的代码段(从一组10对)进行投票(并证明其理由);其中一对使用CDD实践进行了编码。我们收到了133个答案。在第二阶段,我们在CDD引导的重构10对上应用了最先进的可读性模型。 我们观察到了一些矛盾的结果。一方面,开发人员认为CDD指导的重构比其对应物更可读。对于其他两个CDD引导的重构,开发人员尚未确定,而仅在CDD引导的重构之一中,开发人员更喜欢原始代码片段。另一方面,我们注意到只有一个CDD引导的重构具有更好的性能可读性,并由最新的可读性模型评估。我们的结果提供了初始证据,表明CDD可能是软件设计的有趣方法。

Cognitive-Driven Development (CDD) is a coding design technique that aims to reduce the cognitive effort that developers place in understanding a given code unit (e.g., a class). By following CDD design practices, it is expected that the coding units to be smaller, and, thus, easier to maintain and evolve. However, it is so far unknown whether these smaller code units coded using CDD standards are, indeed, easier to understand. In this work we aim to assess to what CDD improves code readability. To achieve this goal, we conducted a two-phase study. We start by inviting professional software developers to vote (and justify their rationale) on the most readable pair of code snippets (from a set of 10 pairs); one of the pairs was coded using CDD practices. We received 133 answers. In the second phase, we applied the state-of-the art readability model on the 10-pairs of CDD-guided refactorings. We observed some conflicting results. On the one hand, developers perceived that seven (out of 10) CDD-guided refactorings were more readable than their counterparts; for two other CDD-guided refactorings, developers were undecided, while only in one of the CDD-guided refactorings, developers preferred the original code snippet. On the other hand, we noticed that only one CDD-guided refactorings have better performance readability, assessed by state-of-the-art readability models. Our results provide initial evidence that CDD could be an interesting approach for software design.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源