Abstract
The flow of control in computer programs is shaped by conditional branches. The Boolean expressions which determine the outcome of a branch may have an effect on the readability of the code. In particular, negations can make such expressions harder to understand. We conduct an experiment with 205 professional developers who needed to understand different logical expressions. The results show that the time needed to understand different expressions of similar size can vary significantly. In general, expressions with more negations take more time, and double negations are especially troublesome. However, there are multiple other factors that also have an effect. For example, literals which are TRUE take less time to process than literals that are FALSE. Regularity (where either all variables have negations or all do not, or where either all literals are TRUE or all are FALSE) also helps. But there are many confounding interactions between the factors, leading to complex outcomes. For example, when comparing De Morgan's logically-equivalent pairs of expressions, we found that understanding a negated OR took slightly more time than the AND of two negations, but there was no difference between a negated AND and the OR of two negations. The factors we identified as influencing the understanding of expressions may contribute to advancing our knowledge of cognitive processes involved in understanding logical expressions, but much additional work is still needed. At the same time, the comparisons of equivalent forms provide some practical advice on how to write more understandable expressions.
Original language | English |
---|---|
Title of host publication | Proceedings of 2024 28th International Conference on Evaluation and Assessment in Software Engineering, EASE 2024 |
Publisher | Association for Computing Machinery |
Pages | 303-312 |
Number of pages | 10 |
ISBN (Electronic) | 9798400717017 |
DOIs | |
State | Published - 18 Jun 2024 |
Event | 28th International Conference on Evaluation and Assessment in Software Engineering, EASE 2024 - Salerno, Italy Duration: 18 Jun 2024 → 21 Jun 2024 |
Publication series
Name | ACM International Conference Proceeding Series |
---|
Conference
Conference | 28th International Conference on Evaluation and Assessment in Software Engineering, EASE 2024 |
---|---|
Country/Territory | Italy |
City | Salerno |
Period | 18/06/24 → 21/06/24 |
Bibliographical note
Publisher Copyright:© 2024 Owner/Author.
Keywords
- Code comprehension
- Logical expression
- Negation