● Module Flexibility
Modules are made flexible by allowing users to feed input values into
the code. The module can then respond differently depending on the
input values provided by the user. The number of inputs that a module
accepts must be defined when a module is written. These inputs are
known as formal parameters. A formal parameter is a variable where
the initial value is bound to the values provided as input to the module.
The modules behavior then depends upon the initial value that is
provided by the user. The initial values provided by the module user
are known as arguments or actual parameter.
● The syntactic pattern for defining formal parameters.
Most Flexible Grill a Steak Module
• We can make our grill Steak module flexible by making the starting
temperature an input that is controlled from the outside of the module.
• Note that the module simply defines what actions the computer should take
to grill a steak.
• The grill Steak module now has one formal parameter. This implies that if we
ever need to use this module to grill a steak that we must supply one actual
parameter.
• The actual parameter becomes the starting steak temperature for the steak
grilling subprocess.
• We want to grill a steak from a starting temperature of 94 degrees. Although
the grill Steak module is now flexible enough to be used with any starting
steak temperature, we can still increase its flexibility by noting that there
are two further circumstances that might not always hold.
A more flexible grill Steak module
An optimally flexible grill Steak module.