arrow
Return

How do annotations affect Java code readability?

delete2024-05-03
delete0
PRE
AI
E
Eduardo Guerra
E
Everaldo Mariano Gomes
J
Jeferson Ferreira
I
Igor Wiese
P
Phyllipe Lima
M
Marco Aurélio Gerosa
P
Paulo Meirelles *
DOI:10.1007/s10664-024-10460-wdelete
deleteOriginal
deleteShare
deleteSave
Abstract

Abstract

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.
Keywords:
Code annotations
Program comprehension
Code readability
Software engineering
Improving code readability classification using convolutional neural networks
err2018-12-01
err34
PREAI
errMi, Qing; Keung, Jacky; Xiao, Yan; Mensah, Solomon; Gao, Yujin
errShare
errSave
How does code readability change during software evolution?
err2020-09-24
err16
PREAI
errPiantadosi, Valentina; Fierro, Fabiana; Scalabrino, Simone; Serebrenik, Alexander; Oliveto, Rocco
errShare
errSave
Learning a Metric for Code Readability
err2010-07-01
err256
PREAI
errBuse, Raymond P. L.; Weimer, Westley R.
errShare
errSave
A graph-based code representation method to improve code readability classification
err2023-05-23
err4
PREAI
errMi, Qing; Zhan, Yi; Weng, Han; Bao, Qinghang; Cui, Longjie; Ma, Wei
errShare
errSave
A Metrics Suite for code annotation assessment
err2018-03-01
err10
PREAI
errLima, Phyllipe; Guerra, Eduardo; Meirelles, Paulo; Kanashiro, Lucas; Silva, Helio; Silveira, Fabio Fagundes
errShare
errSave
An eye tracking study assessing source code readability rules for program comprehension
err2024-10-05
err0
PREAI
errPark, Kang-il; Johnson, Jack; Peterson, Cole S.; Yedla, Nishitha; Baysinger, Isaac; Aponte, Jairo; Sharif, Bonita
errShare
errSave
errShare
errSave

Journal

Empirical Software Engineering cover
Empirical Software Engineering
IF:
3.6
Papers:
2.0K
Citations:
6.4K

Organization

F
Free University of Bozen-Bolzano
Scholars:
168
Papers: 62
Citations: 2.1K
U
universidade federal de itajubá
Scholars:
50
Papers: 30
Citations: 566
U
universidade tecnologica federal do parana
Scholars:
208
Papers: 64
Citations: 1.4K
N
Northern Arizona University
Scholars:
354
Papers: 179
Citations: 4.5K
U
Universidade de São Paulo
Scholars:
2.8K
Papers: 946
Citations: 3.0W
researcher View more organizations
Cited Papers

Cited Papers

errShare
errSave
A Metrics Suite for code annotation assessment
err2018-03-01
err10
PREAI
errLima, Phyllipe; Guerra, Eduardo; Meirelles, Paulo; Kanashiro, Lucas; Silva, Helio; Silveira, Fabio Fagundes
errShare
errSave
errShare
errSave
Women's Participation in Open Source Software: A Survey of the Literature
err2022-08-22
err36
PREAI
errTrinkenreich, Bianca; Wiese, Igor; Sarma, Anita; Gerosa, Marco; Steinmacher, Igor
errShare
errSave
Including Everyone, Everywhere: Understanding Opportunities and Challenges of Geographic Gender-Inclusion in OSS
err2022-09-01
err14
errOAAI
errPrana, Gede Artha Azriadi; Ford, Denae; Rastogi, Ayushi; Lo, David; Purandare, Rahul; Nagappan, Nachiappan
errShare
errSave
researcher View more