4,493
edits
mNo edit summary |
|||
Line 1: | Line 1: | ||
Semantic density is a ''metric'' of the readability of a program by a non-programming domain expert. | Semantic density is a ''metric'' of the [[readability]] of a program by a non-programming domain expert. | ||
Programs work with ''representations'' of some domain. Every program must thus be read in two ways: | Programs work with ''representations'' of some domain. Every program must thus be read in two ways: | ||
Line 8: | Line 8: | ||
The programmer must understand enough of the first to have the computer animate the representational scheme – adequately to the needs of the domain expert. The domain expert can participate in this process most closely when able to follow the domain logic in the program. | The programmer must understand enough of the first to have the computer animate the representational scheme – adequately to the needs of the domain expert. The domain expert can participate in this process most closely when able to follow the domain logic in the program. | ||
This is possible when a sufficiently high proportion of the tokens ( | This is possible when a sufficiently high proportion of the tokens (e.g. names of [[variable]]s or [[function]]s) are drawn from the vocabulary of the reader. (Writers of natural languages, under a general injunction to write with their readers in mind, will find nothing surprising in this.) | ||
Leaving aside any familiarity with programming, the minimum threshold appears to vary little between readers, and is in all cases high. Even a low proportion of ‘foreign’ terms degrades readability. | Leaving aside any familiarity with programming, the minimum threshold appears to vary little between readers, and is in all cases high. Even a low proportion of ‘foreign’ terms degrades readability. |