Page 177 - DCAP507_SYSTEM_SOFTWARE
P. 177

Unit 11: Programming Languages Concept (II)




          "Decide which module you want; partition the program so that data is hidden in modules."  Notes

               !
             Caution  To produce modular design, some criteria must be used to select modules so that
             the module support well defined abstractions and are solvable and modifiable separately.
          A program can be logically separated into the following functional module:
              Initialization

              Input
              Input data validation
              Processing
              Output
              Error handling

              Closing Procedure.
          The modules  reflect a logical flow for a  computer program.  After initialization,  processing
          proceeds logically with input, input validation, various processing modules and output. Error
          handling may be required during execution of any modules.

          11.1.1 Advantages of Modular Approach

              Testing of individual modules in isolation makes tracing errors easier.
              Modules can be kept separately in a library and used anywhere in the program without
               rewriting them.
              A module can use other modules.
              The documentation of a large program is simplified by the documentation of individual
               modules.
              We can develop modules, which contain standard procedures throughout the program,
               thus saves development time.
          A program consists of modules, which may have modules of their own: indeed a program is
          hierarchy of modules. Almost all design contains hierarchies, as creating a hierarchy is a natural
          way to  manage complexity. Moreover the highest level  modules correspond  to the  entire
          program. The question arises at this time is, "In what order should the modules be built-starting
          from the top level or starting from the Bottom level?" To design such hierarchies there are two
          approaches: Top down and Bottom up.

          11.1.2 Top-down Approach

          A  top-down design  approach starts by identifying  the major  modules of the program  i.e.
          decomposing them into their lower level modules and iterating until the desired level of details
          is achieved. First the main module is implemented and then their subroutines and so on. Top
          down design method often results in some forms of stepwise refinement.
          Starting from an abstract design, in each step the design is refined to a more concrete level until
          we  reach a level where no more refinement is required and the design can be implemented
          directly.





                                           LOVELY PROFESSIONAL UNIVERSITY                                   171
   172   173   174   175   176   177   178   179   180   181   182