7B: variables/constants vs literal constants Flashcards
what are constants
values which do not and should be changed
what are literal constants
particular value, must be manually changed, each use independent
when should literal constants be used
when assigned to variables which can be a constant identifier which does not change after declaration
meaningful identifiers
increased readability
what does meaningful variable names increase
maintainability + readability
what are meaningful identifiers used for
variables, subroutines, constants, modules
function of explanatory comments
describe what + how in source code
- documents changes made, programmer’s name, date + nature of changes
standard vs non-standard control structures
standard: sequence, selection, iteration
non-standard: exists, just don’t use
main lines should…
- include minimal processing
- consist of a series of calls to subroutines
- determines top-down design
how to increase subroutine maintainability
one logical task per subroutine
- easier to understand, test, reuse, maintain