During software development, poor design and implementation choices can detrimentally impact software maintainability. Design smells, recurring patterns of poorly designed fragments, signify these issues. Role-stereotypes denote the generic responsibilities that classes assume in system design. Although the concepts of role-stereotypes and design smells differ, both significantly contribute to the design and maintenance of software systems. Understanding the relationship between these aspects is crucial for enhancing software maintainability, code quality, efficient code review, guided refactoring, and the design of role-specific metrics. This paper employs an exploratory approach, combining statistical analysis and unsupervised learning methods, to understand how design smells relate to role-stereotypes across desktop and mobile applications. Analyzing 11,350 classes from 30 GitHub repositories, we identified several design smells that frequently co-occur within certain role-stereotypes. Specifically, three (3) out of six (6) role-stereotypes we studied are more prone to design smells. We also examined the variation of design smells across the two ecosystems, driven by notable differences in their underlying architecture. Findings revealed that design smells are more prevalent in desktop than in mobile applications, especially within the Service Provider and Information Holder role-stereotypes. Additionally, the unsupervised learning method showed that certain pairs or groups of role-stereotypes are prone to similar types of design smells. We believe these relationships are associated with the characteristic and collaborative properties between role-stereotypes. The insights from this research provide valuable guidance for software teams on implementing design smell prevention and correction mechanisms, ensuring conceptual integrity during design and maintenance phases.
翻译:在软件开发过程中,不良的设计与实现选择会对软件可维护性产生负面影响。设计异味作为反复出现的低质量设计片段模式,正是这些问题的表征。角色刻板印象则指代类在系统设计中承担的通用职责。尽管角色刻板印象与设计异味的概念存在差异,但二者均对软件系统的设计与维护具有重要影响。理解这两个维度之间的关系,对于提升软件可维护性、代码质量、改进代码审查效率、指导重构过程以及设计角色化度量指标至关重要。本文采用探索性研究方法,结合统计分析与非监督学习方法,旨在理解桌面端与移动端应用中设计异味与角色刻板印象的关联机制。通过对来自30个GitHub代码库的11,350个类进行分析,我们识别出在特定角色刻板印象中频繁共现的若干设计异味。具体而言,我们所研究的六种角色刻板印象中,有三种更易出现设计异味。我们还考察了两个生态系统间设计异味的分布差异,这种差异主要源于其底层架构的显著不同。研究发现,设计异味在桌面端应用中的出现频率高于移动端应用,尤其在服务提供者与信息持有者这两类角色刻板印象中更为突出。此外,非监督学习方法表明,某些特定的角色刻板印象组合或群体倾向于出现相似类型的设计异味。我们认为这些关联性与角色刻板印象间的特征属性及协作特性密切相关。本研究所得洞见为软件团队实施设计异味预防与修正机制提供了重要指导,有助于确保软件在设计及维护阶段的概念完整性。