As programs grow ever larger and more complex, even the structured programming
approach begins to show signs of strain. You may have heard about, or been involved
in, horror stories of program development. The project is too complex, the schedule
slips, more programmers are added, complexity increases, costs skyrocket, the schedule
slips further, and disaster ensues. (See The Mythical Man-Month by Frederick P.
Brooks, Jr. [Addison Wesley, 1982] for a vivid description of this process.)
Analyzing the reasons for these failures reveals that there are weaknesses in the procedural
paradigm itself. No matter how well the structured programming approach is implemented,
large programs become excessively complex.
What are the reasons for these problems with procedural languages? There are two related
problems. First, functions have unrestricted access to global data. Second, unrelated functions
and data, the basis of the procedural paradigm, provide a poor model of the real world.
Let’s examine these problems in the context of an inventory program. One important global
data item in such a program is the collection of items in the inventory. Various functions access
this data to input a new item, display an item, modify an item, and so on.
No comments:
Post a Comment