Modular Programming

In the “real world”, programs are coded by many programmers. It is often inefficient to all be working on the same file, not to mention it can get very confusing when you have millions of lines of code. We would like to modularize the design and reduce compile time.

Modular programming is basically dividing the program into separate sub-programs where each subprogram serves a specific goal. Breaking the large program into small problems increases the readability and the maintainability of the program, in addition to the reusability of the small subprograms.

Each module has a well-defined interface that specifies what services the module provides as well as an implementation part that hides the code and other details from the user (by providing executable file to the user so they can’t read the actual implementation but yet can use the provided functions listed in the interface with documentation).

An additional advantage is that changing the implementation without changing the interface does not require the user to change the main program that uses/includes those modules. Also, it is much easier to debug a program this way.