当前位置: X-MOL 学术Inf. Softw. Technol. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
A large scale study on how developers discuss code smells and anti-pattern in Stack Exchange sites
Information and Software Technology ( IF 3.9 ) Pub Date : 2020-05-07 , DOI: 10.1016/j.infsof.2020.106333
Amjed Tahir , Jens Dietrich , Steve Counsell , Sherlock Licorish , Aiko Yamashita

Context: In this paper, we investigate how developers discuss code smells and anti-patterns across three technical Stack Exchange sites. Understanding developers perceptions of these issues is important to inform and align future research efforts and direct tools vendors to design tailored tools that best suit developers. Method: we mined three Stack Exchange sites and used quantitative and qualitative methods to analyse more than 4000 posts that discuss code smells and anti-patterns.Results: results showed that developers often asked their peers to smell their code, thus utilising those sites as an informal, crowd-based code smell/anti-pattern detector. The majority of questions (556) asked were focused on smells like Duplicated Code, Spaghetti Code, God and Data Classes. In terms of languages, most of discussions centred around popular languages such as C# (772 posts), JavaScript (720) and Java (699), however greater support is available for Java compared to other languages (especially modern languages such as Swift and Kotlin). We also found that developers often discuss the downsides of implementing specific design patterns and ‘flag’ them as potential anti-patterns to be avoided. Some well-defined smells and anti-patterns are discussed as potentially being acceptable practice in certain scenarios. In general, developers actively seek to consider trade-offs to decide whether to use a design pattern, an anti-pattern or not.Conclusion: our results suggest that there is a need for: 1) more context and domain sensitive evaluations of code smells and anti-patterns, 2) better guidelines for making trade-offs when applying design patterns or eliminating smells/anti-patterns in industry, and 3) a unified, constantly updated, catalog of smells and anti-patterns. We conjecture that the crowd-based detection approach considers contextual factors and thus tend to be more trusted by developers than automated detection tools.



中文翻译:

有关开发人员如何在Stack Exchange站点中讨论代码气味和反模式的大规模研究

上下文:在本文中,我们研究开发人员如何在三个技术Stack Exchange站点上讨论代码的气味反模式。了解开发人员对这些问题的看法对于通知和调整未来的研究工作,并指导工具供应商设计最适合开发人员的量身定制的工具非常重要。方法:我们挖掘了三个Stack Exchange网站,并使用定量和定性方法分析了4000多个讨论代码气味和反模式的帖子。结果:结果表明,开发人员经常要求他们的同伴闻其代码,从而将这些站点用作基于人群非正式站点代码气味/反模式检测器。提出的大多数问题(556)都针对诸如重复代码,意大利面条代码,上帝和数据类别等气味。在语言方面,大多数讨论都围绕流行的语言进行,例如C (772帖子),JavaScript(720)和Java(699),但是与其他语言(尤其是现代语言,例如Swift和Kotlin)。我们还发现,开发人员经常讨论实现特定设计模式的弊端,并将其“标记”为要避免的潜在反模式。在某些情况下,一些定义明确的气味和反模式可能被接受。通常,开发人员会积极寻求权衡取舍决定是否使用设计模式,是否使用反模式。结论:我们的结果表明,需要:1)对代码气味和反模式进行更多的上下文和域敏感评估,2)在行业中应用设计模式或消除气味/反模式时进行取舍的更好准则,以及3)统一的,不断更新的气味和反模式目录。我们推测,基于人群的检测方法考虑了上下文因素,因此与自动检测工具相比,开发人员更倾向于信任它们。

更新日期:2020-05-07
down
wechat
bug