Terms for Chapters 7 and 8: Subroutines & Scope.
Subroutine
A named set of instructions with a well-defined task.
Function
Subroutine which is called within an expression and returns a single value.
Procedure (In C++, aka a "void" function)
Subroutine with 0 or more parameters whose call stands alone. Can return
0 or more values via its parameter list.
Parameter list
Means by which subroutines communicate with each other.
Pass-by-value parameter
Parameter for which a copy is "passed to" the subroutine.
Pass-by-reference parameter
Parameter whose address is passed to the subroutine.
Actual parameter
A variable or expression listed in the call to a subroutine.
Formal parameter
A variable declared in the subroutine's heading.
Argument
Term sometimes applied to a parameter.
Modularity
Extent to which a program has been designed in a stepwise fashion using
subroutines.
Cohesion
The degree with which a subroutine performs a single well-defined task.
A high level of cohesion is desired.
Functional cohesion
The best kind! The principle that a module should perform one well-defined
task.
Prototype (C++)
Information about the name and data types of parameters (and the returned
value of a function) usually provided to the compiler near the beginning
of the program. Like a "forward declaration".
Local variable
One declared within a block. Not accessible outside of that block.
Header file
File containing declarations of some combination of constants, types, and
subroutines available for other modules to use.
Scope of an identifier
The region of program code where it is legal to reference (use) a particular
identifier.
Local scope
Scope of an identifier declared inside a block extends from the point of
declaration to the end of that block.
Global scope
Scope of an identifier-- declared outside all subroutines--which extends
from the point at which it is declared to the end of the entire file containing
the rest of the program's code.
Side effect
Any effect of one subroutine on another that is not part of the explicitly
defined interface between them.
Boolean function
One which returns a true or false.