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

Shulamyt Ajami, Yonatan Woodbridge, Dror G. Feitelson

Research output: Contribution to journalArticlepeer-review

Abstract

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 languageEnglish
Pages (from-to)287-328
Number of pages42
JournalEmpirical Software Engineering
Volume24
Issue number1
DOIs
StatePublished - 15 Feb 2019

Keywords

  • Code complexity
  • Gamification
  • Program understanding

All Science Journal Classification (ASJC) codes

  • Software

Fingerprint

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

Cite this