The difference between monolithic programming and modular programming along with the advantages and disadvantage are explained below in detail.
If, we write an entire program in a single function that is in main function then, you call it as a monolithic type of programming. But, it is not a good style of writing entire logic in a single function.
The disadvantages of monolithic programming include −
If the program is divided into number of functional parts, then we use to call it as modular programming.
If the main program is divided into sub programs, then we can independently code each sub module later combine into single unit. This type of individual modules is termed as functions.
The advantages of modular programming include −
Example of modular programming
An example of modular programming is given below −
The splitting of a problem into its related sub problems is analogous to the process of refining an algorithm.
Performing arithmetic operations on two numbers
The steps are given below −
Refined algorithm for third step
The refined algorithm to find product of two numbers is as follows −
The structure chart is explained below −