Syntax, predicates, idioms — what really affects code complexity?

Shulamyt Ajami, Yonatan Woodbridge, Dror G. Feitelson*

*Corresponding author for this work

Research output: Contribution to journalArticlepeer-review

28 Scopus citations


Program comprehension concerns the ability to understand code written by others. But not all code is the same. We use an experimental platform fashioned as an online game-like environment to measure how quickly and accurately 220 professional programmers can interpret code snippets with similar functionality but different structures; snippets that take longer to understand or produce more errors are considered harder. The results indicate, inter alia, that for loops are significantly harder than if s, that some but not all negations make a predicate harder, and that loops counting down are slightly harder than loops counting up. This demonstrates how the effect of syntactic structures, different ways to express predicates, and the use of known idioms can be measured empirically, and that syntactic structures are not necessarily the most important factor. We also found that the metrics of time to understanding and errors made are not necessarily equivalent. Thus loops counting down took slightly longer, but loops with unusual bounds caused many more errors. By amassing many more empirical results like these it may be possible to derive better code complexity metrics than we have today, and also to better appreciate their limitations.

Original languageAmerican English
Pages (from-to)287-328
Number of pages42
JournalEmpirical Software Engineering
Issue number1
StatePublished - 15 Feb 2019

Bibliographical note

Publisher Copyright:
© 2018, Springer Science+Business Media, LLC, part of Springer Nature.


  • Code complexity
  • Gamification
  • Program understanding


Dive into the research topics of 'Syntax, predicates, idioms — what really affects code complexity?'. Together they form a unique fingerprint.

Cite this