On the effect of code regularity on comprehension

Ahmad Jbara, Dror G. Feitelson

Research output: Chapter in Book/Report/Conference proceedingConference contribution

13 Scopus citations

Abstract

It is naturally easier to comprehend simple code relative to complicated code. Regrettably, there is little agreement on how to effectively measure code complexity. As a result simple generalpurpose metrics are often used, such as lines of code (LOC), Mc- Cabe's cyclomatic complexity (MCC), and Halstead's metrics. But such metrics just count syntactic features, and ignore details of the code's global structure, which may also have an effect on understandability. In particular, we suggest that code regularity-where the same structures are repeated time after time-may significantly reduce complexity, because once one figures out the basic repeated element it is easier to understand additional instances. We demonstrate this by controlled experiments where subjects perform cognitive tasks on different versions of the same basic function. The results indicate that versions with significant regularity lead to better comprehension, while taking similar time, despite being longer and having higherMCC. These results indicate that regularity is another attribute of code that should be taken into account in the context of studying the code's complexity and comprehension. Moreover, the fact that regularity may compensate for LOC and MCC demonstrates that complexity cannot be decomposed into independently addable contributions by individual attributes.

Original languageEnglish (US)
Title of host publication22nd International Conference on Program Comprehension, ICPC 2014 - Proceedings
PublisherAssociation for Computing Machinery, Inc
Pages189-200
Number of pages12
ISBN (Electronic)9781450328791
DOIs
StatePublished - Jun 2 2014
Externally publishedYes
Event22nd International Conference on Program Comprehension, ICPC 2014 - Hyderabad, India
Duration: Jun 2 2014Jun 3 2014

Publication series

Name22nd International Conference on Program Comprehension, ICPC 2014 - Proceedings

Conference

Conference22nd International Conference on Program Comprehension, ICPC 2014
CountryIndia
CityHyderabad
Period6/2/146/3/14

Keywords

  • Code complexity
  • Code regularity
  • LOC
  • MCC

ASJC Scopus subject areas

  • Hardware and Architecture
  • Software

Fingerprint Dive into the research topics of 'On the effect of code regularity on comprehension'. Together they form a unique fingerprint.

  • Cite this

    Jbara, A., & Feitelson, D. G. (2014). On the effect of code regularity on comprehension. In 22nd International Conference on Program Comprehension, ICPC 2014 - Proceedings (pp. 189-200). (22nd International Conference on Program Comprehension, ICPC 2014 - Proceedings). Association for Computing Machinery, Inc. https://doi.org/10.1145/2597008.2597140