Use abstraction to manage complexity in a program.
Explain how abstraction manages complexity.
Learning Objective:
Explain how the use of procedural abstraction manages complexity in a program.
One common type of abstraction is procedural
abstraction, which provides a name for a
process and allows a procedure to be used
only knowing what it does, not how it does it.
AAP-3.B.2
Procedural abstraction allows a solution to a
large problem to be based on the solutions of
smaller subproblems. This is accomplished
by creating procedures to solve each of the
subproblems.
AAP-3.B.3
The subdivision of a computer program into
separate subprograms is called modularity.
AAP-3.B.4
A procedural abstraction may extract shared
features to generalize functionality instead of
duplicating code. This allows for program code
reuse, which helps manage complexity.
AAP-3.B.5
Using parameters allows procedures to be
generalized, enabling the procedures to
be reused with a range of input values or
arguments.
AAP-3.B.6
Using procedural abstraction helps improve
code readability.
AAP-3.B.7
Using procedural abstraction in a program
allows programmers to change the internals of
the procedure (to make it faster, more efficient,
use less storage, etc.) without needing to
notify users of the change as long as what the
procedure does is preserved.
Learning Objective:
Develop procedural abstractions to manage complexity in a program by
writing procedures.
The exam reference sheet provides
Text:
PROCEDURE procName(parameter1,
parameter2, ...)
{
<block of statements>
}
which is used to define a procedure that takes zero or more arguments. The procedure contains block of statements
The exam reference sheet provides
Text:
PROCEDURE procName(parameter1,
parameter2, ...)
{
<block of statements>
RETURN(expression)
}
which is used to define a procedure that
takes zero or more arguments. The procedure
contains block of statements and
returns the value of expression. The
RETURN statement may appear at any point
inside the procedure and causes an immediate
return from the procedure back to the calling
statement.