×
☰ Menu

Modular Programming


Modular programming is the process of subdividing a computer program into separate sub-programs.

Or

Modular programming is a software development technique that stresses the separation of a program's functionality into separate, replaceable modules.


A module is a discrete piece of software. It can be utilized in a range of applications and functions in conjunction with other system components. Separate functions are built as separate units of code so that the code can be reused by other applications. Similar functions are combined in the same unit of programming code.

In C we use functions also referred to as modules to perform a specific task that we determined in our solution.

This strategy is essentially based on the divide and conquer approach to problem-solving and has many advantages in developing a program for the entire problem.
We will assign a name to each module and combine the named modules in a program structure under the control of the main program

 

Need of the modular programming:

  • When a program grows in size and complexity, it becomes increasingly difficult for programmers to develop, test, and debug it.
  • As a result, a large program may be broken down into smaller programs called modules, each of which can be written, tested, and debugged independently, making the programmer's job easier and more convenient.
  • It makes your programs easy to understand.


Advantages of using modules

  • Separate modules can be written and tested.
  • Modules can be used again and again.
  • Large tasks can be worked on concurrently.
  • Reduces the length of the programme, making it easier to read.Encourages the use of abstraction.
  • A task's specifics are hidden behind a module.
  • We only need to know what this module does, not how it does it

Disadvantages of using modules

  • Module documentation must be organized.
  • When modules are linked, this can pose issues because the link must be thoroughly tested.
  • Because distinct modules map out the same functions, modular programming sometimes necessitates additional time and memory.