arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2107.04720cs.SE
收藏

Java中数据约束实现的实证研究

An Empirical Study of Data Constraint Implementations in Java

Juan Manuel Florez, Laura Moreno, Zenong Zhang, Shiyi Wei, Andrian Marcus

摘要:

软件系统是根据业务规则定义的指导方针和约束来设计的。其中一些约束定义了系统处理的数据的允许值或必需值。这些数据约束通常源自问题域(例如,法规),开发人员必须编写执行这些法规的代码。了解数据约束是如何实现的对于测试、调试和软件更改是必不可少的。不幸的是,在如何实现数据约束方面没有广泛接受的指导方针或最佳实践。本文提出了一个实证研究,调查如何在Java中实现数据约束。我们研究了从8个真实世界的Java软件系统的文档中提取的187个数据约束的实现。首先,我们对数据约束的文本描述进行了定性分析,并确定了四种数据约束类型。其次,我们手动识别这些数据约束的实现,并揭示它们可以分为30个实现模式。对这些实现模式的分析表明,开发人员在实现数据约束时更喜欢少数模式,偏离这些模式与不寻常的实现决策或代码气味有关。第三,我们开发了一个工具辅助协议,使我们能够确定256个额外的跟踪链接的数据约束,使用13个最常见的模式。我们发现,几乎一半的这些数据约束有多个强制语句,这是不同类型的代码克隆。

英文摘要:

Software systems are designed according to guidelines and constraints defined by business rules. Some of these constraints define the allowable or required values for data handled by the systems. These data constraints usually originate from the problem domain (e.g., regulations), and developers must write code that enforces them. Understanding how data constraints are implemented is essential for testing, debugging, and software change. Unfortunately, there are no widely-accepted guidelines or best practices on how to implement data constraints. This paper presents an empirical study that investigates how data constraints are implemented in Java. We study the implementation of 187 data constraints extracted from the documentation of eight real-world Java software systems. First, we perform a qualitative analysis of the textual description of data constraints and identify four data constraint types. Second, we manually identify the implementations of these data constraints and reveal that they can be grouped into 30 implementation patterns. The analysis of these implementation patterns indicates that developers prefer a handful of patterns when implementing data constraints and deviations from these patterns are associated with unusual implementation decisions or code smells. Third, we develop a tool-assisted protocol that allows us to identify 256 additional trace links for the data constraints implemented using the 13 most common patterns. We find that almost half of these data constraints have multiple enforcing statements, which are code clones of different types.

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

↑