The earlier chapters of this book were devoted to teaching traditional procedure-oriented structured programming techniques for solving C and C++ problems. These chapters introduced you to fundamental C and C++ syntax in a familiar programming environment. Procedure-oriented programming is common among all structured languages, including C, C++, Pascal, and PL/I. A procedure-oriented C or C++ program is structured in such a way that there is typically a main( ) function and possibly one or more functions (subroutines) that are called from the main( ) function. This is a top-down approach. The main( ) function is typically short, shifting the work to the remaining functions in the program. Program execution flows from the top of the main( ) function and terminates at the bottom of the same function.
In this approach, code and data are separate. Procedures define what is to happen to data, but the two never become one. You’ll see that this changes in object-oriented programming. The procedural approach suffers from several disadvantages, chiefly program maintenance. When additions or deletions must be made to the program code, such as in a database program, the entire program must often be reworked to include the new routines. This approach takes enormous amounts of time in both development and debugging. A better approach toward program maintenance is needed.