Five elements of mental discipline.

One of Dijkstra's main questions was:

"Can the programmer arrange his activity in such a way that his growing product remains firmly in his intellectual grip, that he continues to understand what he is doing?" [EWD303]

To write structured programs, Dijkstra proposed five well-known techniques:

  • sequencing
  • operational abstraction
  • representational abstraction
  • configurational abstraction (cf. layered software)
  • textual encapsulation (cf. modularity)

The latter two are discussed here.

Configurational abstraction essentially refers to layered software, as encountered in Dijkstra's THE operating system:

I am referring to the functions of an operating system that can rebuild a single processor installation into a multiple processor installation, that can rebuild a hierarchy of storage levels into a virtual store etc. [EWD303]

Dijkstra mentioned configurational abstraction's two main goals. First, it helps towards program portability. Second, it allows one to build a virtual machine which is much more attractive to program than the underlying machine.

Textual encapsulation has to do with viewing a program as part of a family of neighboring programs, not as a stand-alone entity. In his words:

It is becoming recognized more and more that it is highly desirable that the transformation of a program into another one of the family should only affect well isolated portions of the program text and should not require adjustments scattered all through the program text.

Tags: