Professional Documents
Culture Documents
Sliit Academy: Higher Diploma in Information Technology - Year 1, Semester 1
Sliit Academy: Higher Diploma in Information Technology - Year 1, Semester 1
Modularization
Ruchira ManikkaArachchi
structure.
• When defining the problem, write down the activities or processing steps
to be performed.
• These activities are then grouped together to form more manageable tasks
or functions, which will eventually become modules.
• A module must be large enough to perform its task and must include only
the operations that contribute to the performance of that task.
sequence of instructions.
• The name of the module should describe the work to be done as a single
specific function.
• The convention of naming a module by using a verb, followed by a two-
• Since each module performs a single specific task, a mainline routine must
provide the master control that ties all the modules together and
coordinates their activity.
• This program mainline should show the main processing functions, and the
order in which they are to be performed.
• It should also show the flow of data and the major control structures.
• The mainline should be easy to read, be of manageable length, and show
SLIIT Academy Pvt Ltd. © 2020
sound logic structure.
Practice Question 01
Design a solution algorithm that will prompt a terminal operator for three
characters, accept those characters as input, sort them into ascending
sequence and output them to the screen. The algorithm is to continue to
read characters until ‘AAA’ is entered.
Read_three_characters()
ENDWHILE
END
Print_three_characters
print char_1, char_2, char_3
END
• Once the tasks have been grouped into functions or modules, these
modules can be represented graphically in a diagram.
• This diagram is known as a hierarchy chart, as it shows not only the names
of all the modules but also their hierarchical relationship to each other.
• The hierarchy chart uses a tree-like diagram of boxes; each box represents
a module in the program and the lines connecting the boxes represent the
relationship of the modules to others in the program hierarchy.
SLIIT Academy Pvt Ltd. © 2020
Hierarchy Charts
Process_three_characters)
Step 01:
Define the problem by dividing it into its three components: input, output
Step 02:
the performance of a single task. Not all the activities may be identified at
this stage. Only the modules on the first level of the hierarchy chart may be
Step 03:
Construct a hierarchy chart to illustrate the modules and their relationship
to each other. Once the structure (or organization) of the program has been
developed, the order of processing of the modules can be considered.
.
Step 04:
Establish the logic of the mainline of the algorithm in pseudocode. This
mainline should contain some initial processing before the loop, some
processing within the loop, and some final processing after exiting the loop.
It should contain calls to the major processing modules of the program and
should be easy to read and understand.
Step 05:
Develop the pseudocode for each successive module in the hierarchy chart.
The modularization process is complete when the pseudocode for each
module on the lowest level of the hierarchy chart has been developed.
Step 06:
Desk check the solution algorithm. This is achieved by first desk checking
the mainline, then each subordinate module in turn.
SLIIT Academy Pvt Ltd. © 2020
Summary
• This chapter introduced a modular approach to program design.
• A module was defined as a section of an algorithm that is dedicated to the
performance of a single function.
• Top-down design was defined as the process of dividing a problem into
major tasks and then into further subtasks within those major tasks until
all the tasks have been identified.