Program Comprehension

Michael L. Collard, Ph.D.

Department of Computer Science, The University of Akron

Scheme

Run

C++

C++11

Program Comprehension

  • AKA program understanding
  • The ways in which software engineers understand and make changes to existing source code

Program Comprehension Type

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

Language Comprehension

  • Understanding of basic syntax
  • Ability to read programs in a language
    • e.g., follow what a for loop is doing
  • Ability to write programs in a language
    • e.g., write a loop for of a task
  • 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 being used
  • E.g., std::vector, copy(), 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 knowledge of good examples can be applied to entire API/library

Platform

  • Have to be able to build and run
  • E.g., C++: g++ to build, run executable directly
  • Knowledge of IDE, build tools, version control, etc.
  • IDEs make things easier, but introduce their own complications
  • Complexity: Apps not native to developement platform:
    • iOS & Android apps
    • Cloud applications

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 probably only understandable to someone who is solving problems in that domain

Domain Example 1

double z = x * y;

Domain Example 2

double p = h * r;

Domain Example 3

double pay = hours * rate;

Programming Style

  • E.g., Obfuscated C
  • Consistenty of a programming style does not prevent comprehension, but may impede it
  • Programming style can interfere with searching