Understanding Logical Expressions with Negations: Its Complicated

Aviad Baron, Ilai Granot, Ron Yosef, Dror Feitelson

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review


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 languageEnglish
Title of host publicationProceedings of 2024 28th International Conference on Evaluation and Assessment in Software Engineering, EASE 2024
PublisherAssociation for Computing Machinery
Number of pages10
ISBN (Electronic)9798400717017
StatePublished - 18 Jun 2024
Event28th International Conference on Evaluation and Assessment in Software Engineering, EASE 2024 - Salerno, Italy
Duration: 18 Jun 202421 Jun 2024

Publication series

NameACM International Conference Proceeding Series


Conference28th International Conference on Evaluation and Assessment in Software Engineering, EASE 2024

Bibliographical note

Publisher Copyright:
© 2024 Owner/Author.


  • Code comprehension
  • Logical expression
  • Negation


Dive into the research topics of 'Understanding Logical Expressions with Negations: Its Complicated'. Together they form a unique fingerprint.

Cite this