In: Computer Science
Modular design is a design that creates things out of independent parts with standard interfaces. This allows designs to be customized, upgraded, repaired, and for parts to be reused. A popular example of modular design are LEGO plastic construction toys.
Modular programming is a software design technique that emphasizes separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality.
The module is basically a set of interrelated files that share their implementation details but hide it from the outside world.
Modular Design Examples:
1. Using one function for taking in the program and using another program to display output.
class demo
{
public:
get(int x)
{}
set()
{}
}
2. Using various functions for calculating various types of areas in a single program.
int rectangeArea(int l, int b)
{
return l*b;
}
int circleArea(int r)
{
return 3.14*r*r;
}
In modular approach, we have used different modules/functions for different types of tasks/functions to be performed.