Program Comprehension

Michael L. Collard, Ph.D.

Department of Computer Science, The University of Akron

Scheme

Run

C++

C++11

Program Comprehension

How software engineers understand and make changes to existing source code

  • AKA program understanding

Program Comprehension Type

  • Language
  • API/library
  • Platform
  • Domain
  • Programming Style

Language Comprehension

  • Understanding of the basic syntax
  • Ability to read programs in a language
  • e.g., read and understand what a for loop is doing
  • Ability to write programs in a language
  • e.g., implement and write a for loop
  • Know the language paradigm, e.g., object-oriented languages
  • Know the general family of languages, e.g., know C++ but can follow Java

API/Library Comprehension

  • Know the APIs and programming libraries used
  • E.g., std::vector, std::copy(), std::iostream, std::ostream_iterator
  • Based on identifiers and text in comments
  • Impossible to know all parts of a modern API/library
  • If APIs or libraries are consistent, then you can apply knowledge of good examples to the entire API/library

Platform

  • Have to be able to build and run
  • E.g., C++: g++ to build, run the executable directly
  • Knowledge of IDE, build tools, and version control
  • IDEs make things easier but introduce additional complications

Platform Complexity

  • Non-native apps
  • iOS apps
  • Simulator
  • Android apps
  • Emulator
  • Cloud applications
  • Move from x86 to ARM, e.g., Fugaku, ARM cheaper per core
  • So what do you use on your desktop?

Domain

  • Based on identifiers and text in comments
  • E.g., Gamma
  • E.g., Stencil Library
  • E.g., Networking
  • These solutions apply to specific domains and are only understandable to someone who is solving problems in that domain

Domain Example 1

Domain Example 2

Domain Example 3

Programming Style

  • E.g., Obfuscated C
  • Inconsistency of programming style impedes comprehension
  • Bad programming style interferes with search