返回
How do annotations affect Java code readability?
注释如何影响Java代码的可读性?
DOI:10.1007/s10664-024-10460-w.png)
摘要
En 中文
ContextCode annotations have gained widespread popularity in programming languages, offering developers the ability to attach metadata to code elements to define custom behaviors. Many modern frameworks and APIs use annotations to keep integration less verbose and located nearer to the corresponding code element. Despite these advantages, practitioners' anecdotal evidence suggests that annotations might negatively affect code readability.ObjectiveTo better understand this effect, this paper systematically investigates the relationship between code annotations and code readability.MethodIn a survey with software developers (n=332), we present 15 pairs of Java code snippets with and without code annotations. These pairs were designed considering five categories of annotation used in real-world Java frameworks and APIs. Survey participants selected the code snippet they considered more readable for each pair and answered an open question about how annotations affect the code's readability.ResultsPreferences were scattered for all categories of annotation usage, revealing no consensus among participants. The answers were spread even when segregated by participants' programming or annotation-related experience. Nevertheless, some participants showed a consistent preference in favor or against annotations across all categories, which may indicate a personal preference. Our qualitative analysis of the open-ended questions revealed that participants often praise annotation impacts on design, maintainability, and productivity but expressed contrasting views on understandability and code clarity.ConclusionsSoftware developers and API designers can consider our results when deciding whether to use annotations, equipped with the insight that developers express contrasting views of the annotations' impact on code readability.
Keyword:
Code annotations
Program comprehension
Code readability
Software engineering
期刊
IF:
3.6
论文数:
2.0K
被引数:
6.4K
机构
引用论文
Taxonomies in software engineering: A Systematic mapping study and a revised taxonomy development method软件工程中的分类法: 系统的映射研究和修订的分类法开发方法
Broadband RCS reduction and high gain waveguide slot antenna with orthogonal array of polarisation‐dependent AMC宽带RCS减缩与高增益波导缝隙天线,该天线采用正交排列的极化依赖型AMC。

