0% found this document useful (0 votes)
15 views3 pages

Flexible Module Design for Grilling

The document discusses the concept of module flexibility in programming, highlighting how user-defined input values (arguments) can influence a module's behavior through formal parameters. It uses the example of a 'grill Steak' module, which can accept a starting temperature as an input to enhance its flexibility. The document suggests that further enhancements could be made to increase the module's adaptability in different scenarios.

Uploaded by

manojabhi2303
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

Flexible Module Design for Grilling

The document discusses the concept of module flexibility in programming, highlighting how user-defined input values (arguments) can influence a module's behavior through formal parameters. It uses the example of a 'grill Steak' module, which can accept a starting temperature as an input to enhance its flexibility. The document suggests that further enhancements could be made to increase the module's adaptability in different scenarios.

Uploaded by

manojabhi2303
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

● 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.

You might also like