One of the most prominent problems in software engineering has been how to program large and complex pieces of software. Often, large projects involve hundreds of programmers working on millions of lines of code. In this kind of environment, it is easy to lose track of what particular code does, or to produce code that must be rewritten elsewhere. To avoid such poor-planning scenarios, computer scientists began to organize around the concept of "modularization," which means to break up and organize code based on the task it executes. In this way, code becomes reusable and easier to debug and manage.
Easier to Debug
Video of the Day
When debugging large programs, how and when any bugs occur can become a mystery. This can take much of a programmer valuable time as he searches through lines and lines of code to find out where an error occurred, and problems it causes later in the program. If a program is designed with modularity in mind, however, then each discrete task has its own discrete section of code. So, if there is a problem in a particular function, the programmer knows where to look and can manage a smaller portion of code.
Video of the Day
Reusable Code
Modular code allows programmers to easily reuse code. If particular tasks are sectioned off to certain functions or classes, this means that the programmer can reuse that particular code whenever she needs to perform that task again. If code is not organized into discrete parts, then it is harder (or impossible) to reference, separate or implement that code in other programming contexts.
Readability
Modular code is code that is highly organized. To organize code based on task means that the programmer can organize each piece of code based on what it does. Then, she can easily find or reference that code based on her organization scheme. Furthermore, other programmers working on the code can follow her organization scheme to read the code as well. This optimizes code for use among multiple developers with less trouble.
Reliability
All these advantages add up to one big advantage: reliability. Code that is easier to read, easier to debug, easier to maintain and easier to share will always run smoother with less errors. This becomes necessary when working on extremely large projects, with hundreds of developers, all of which have to either share code or work on code that will have to interface with other developers' code in the future. Modularization of code is necessary to create complex software reliably.