Computer for SEE and NEB

It is a complete SEE and NEB solution for computer science. It includes Computer Fundamentals, Database (SQL), Programming in C QBASIC, CSS, JavaScript, and PHP for beginners.

Breaking

Post Top Ad

Your Ad Spot

Monday, February 7, 2022

Introduction of Modular Programming

 

Modular Programming in QBASIC


Introduction:

When a program becomes a large and complex, the program is divided into small and easy manageable parts so that it is easy to find and correct errors in the program. The programmer splits the program or codes into relatively small sections of the code rather than leaving it in one massive chunk. These small sections of the code are called modules or subprograms or procedures. Each section of the code should perform one particular job and it should also be encapsulated into a system. Modules are useful when an operation is to be performed for many times in different places of the program. This approach of the programming is called modular programming. In modular programming, whenever the task is to be done, the control is transferred to the sub modules and after the job is over, the control is transferred back to the main module or program.

The modules are also called procedures. Procedures are useful for implementation of the repeated tasks such as frequently used calculations. Using modules in the program, the coding is clean and easier to understand and maintain. QBASIC supports a modular programming. A module is an individual page or file which can be separately compiled. The best reason of module is to divide a program into many different sections so that it enables to write long programs having thousands of line and also make easy to debug and understand to the programmer.

 


Advantages of Modular Programming

i) It is easier to understand.

ii) Easy to find out the errors.

iii) It is easy to modify.

iv) Codes can be stored using multiple files.

v) Programmer can make own module according to requirement.

vi) It allows certain part of the code that can be used in multiple applications.

vii) In a large program, which may contain thousands of line, comes into small segment which can understand by any new programmer.

viii) In a large program, which may contain thousands of line, comes into small segment which can understand by any new programmer


Modules in Modular programming:

The modules are also called procedure in QBASIC. A program may have a number of modules used. There are two kinds of module in QBASIC modular programming. They are:

i) Main Module

i) Sub module


Main Module:

In the QBASIC modular programming, the entry point of a program which contains many sub modules or subprograms or procedures. The main module controls the entire modules used in the program. The main module is starting point and the ending point of the program. It contains the codes to manage sub-module level codes. The main module appears on the programming window when the user loads the program. To select the other sub-modules or procedures in that program, press F2 key which display the list of modules and choose the one which you want.


Sub Module:

The module which are written under the sub module is known as sub modules. A sub module contains a part of code perform a certain specific task. It is also called procedure or sub program. A sub module is independent of other sub modules. A sub module can contain other sub modules. Every sub module is controlled by the main module.


No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages