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.
翻译:COnitive- Dription Development (CDD) 是一种编码设计技术,旨在减少开发者在理解给定代码单位(例如一个类)时所投入的认知努力。根据CDD设计做法,预计编码单位将较小,从而更容易维护和进化。然而,目前还不清楚使用CDD标准编码的这些较小的代码单位是否确实更容易理解。在这项工作中,我们旨在评估CDD改进代码的可读性。为了实现这一目标,我们进行了两阶段研究。我们首先邀请专业软件开发者对最可读的一对代码片(来自一套10对的代码)进行投票(并证明其性能合理性)。通过CDDD设计做法,我们收到了133个答案。在第二阶段,我们应用了CDDD制导的10对可读性模型。我们通过提供一些相互矛盾的结果。一方面,开发者认为,7个(在10对10个初始版本的代码中,1个在CDDD- 制导的驱动式的CD- Redordeadd Redal对应器中,我们只读了另外1个代码。