Concept of Modular Programming


We are learning only ways to prepare small programs, which only contain some lines of code. Do you know what? The software which we use in our daily life such as Microsoft Word, Microsoft Excel, MS-Paint, Word-Pad, Notepad, PowerPoint-like application software also builds by writing a line of codes. To build this type of program programmers have to write thousands or millions of lines of code, which is a very tedious task. Now you can guess so, how difficult it is to write a lot of codes and how hard it is to prepare. How do find out the mistakes in such a long code? how to add and remove some codes in the big program? and how to handle the problem?

To solve this problem, the programmers have to use the concept of modular programming. Actually, we follow this technique when our programs become large, we divided the large programs into small pieces called modules. By making a small block of statements inside the module. We write many lines of code inside our module to do a particular task, simply like to add two numbers, to find the area of geometrical objects, and to do various complex tasks. We can test each module separately and we can easily debug the program.

Defination 
Modular programming is an approach of programming in which a large program is divided into separate independent units called modules.  

Module refers to the block of statements or set of instructions to perform specific tasks in the program. It is also known as 'Procedure'. To build the complete software programmers have to make many separate modules and finally these modules combined together.

Advantages of Modular Programming

There are many advantages of modular programming, some of them are given below.

  • It's easy to understand and manage the program's code.
  • In different modules of the same program, different programmers can be able to work at the same time, for that reason within a short period of time perfect program can be prepared.
  • Once the module is ready, the module can be repeatedly used in anywhere the program. Due to this time and computer memory will be saved.
  • Each module can be tested by running it separately, due to this programmers can find the faults in the program and debug them.
  • Changing something in the program will be quick and easy.

Procedure

The procedure is a set of instructions that is build to perform a specific task in the program. It is also known as a sub-program. Each procedure has its own unique name which is also called procedure name. We can use this procedure in any part of the program by calling them. In QBASIC there are two types of procedures.

  1. SUB Procedure
  2. FUNCTION Procedure

  2317