Skip to main content
Log in

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

  • Published:
Empirical Software Engineering Aims and scope Submit manuscript


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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8

Similar content being viewed by others


  1. Subjects who did not answer the academic degree questions were assigned to the group of no degree.


Download references


Many thanks to Micha Mandel for his help with the statistical analysis, and to the anonymous reviewers for their comments and suggestions.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Dror G. Feitelson.

Additional information

Communicated by: David Lo and Alexander Serebrenik

Dror Feitelson holds the Berthold Badler chair in Computer Science. This research was supported by the ISRAEL SCIENCE FOUNDATION (grant no. 407/13). This paper is an invited extended version of a paper from ICPC 2017.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Ajami, S., Woodbridge, Y. & Feitelson, D.G. Syntax, predicates, idioms — what really affects code complexity?. Empir Software Eng 24, 287–328 (2019).

Download citation

  • Published:

  • Issue Date:

  • DOI: