Introduction to Modular Programming
Here we are explaining about modular programming in Qbasic. Modular programming is a technique that simplifies the large and complex programs by dividing into smaller programs. These small programs are called as procedures/modules. Modular programming is a technique of preparing computer programs in which large program is divided into to separate independent units. These units are called modules.
Advantages of Modular Programming:
1. It makes easy to create a large program.
2. It makes easy to modify and maintain the program code.
3. It is easy to debug the program.
4. The complex program is divided into small and simple easily manageable programs.
5. Each module can run and test individually.
Types of Modules
There are two types of modules in modular programming that is main module and sub module.
1. Main Module:
It is the main program of modular programming where main code is written by the programmer. The main code of starting and ending the program is to be mention here. As the main module runs the control of the program starts and then it transfer the control to the sub modules.
2. Sub Module:
Sub module is sometimes known as procedures in modular programming. Sub module is the part of modular programming where user specify the codes to perform the specific task. The sub module is totally manage and control by the main module in modular programming.
Procedures and their types
Procedure is also known as modules or mini program to perform the specific task in modular programming. Each procedure has a unique name and control by the main program in modular programming. In Qbasic modular programming a procedure is a set of statements, codes to perform the specific task. Qbasic uses two types of procedures they are as follows
1. Sub procedure:
The procedure which are created by the SUB….END SUB statements are called Sub procedures.
2. Function procedures:
The procedure which are created by the FUNCTION….END FUNCTION statements are called Function procedures.
Introduction to modular programming video tutorial