Modularizing Data

In conventional, structured programming, actions like print are often isolated from the data by placing them in subroutines or modules. A module typically contains an operation for implementing one simple action. You might have a PRINT module, a SEND module, an ERASE module. The data these modules operate on must be constructed by the programmer and passed to the modules to perform an action.

But with object-oriented programming, it is the data that is modularized. And each data module includes its own operations for performing actions directly related to its data. The programmer that uses the objects need only be aware of the operations an object performs and not how the data is organized internally.

Figure 1-1. Modular Data—a Report Object

In the case of report, the report object would contain its own built-in PRINT, SEND, ERASE, and FILE operations.

Object-oriented programming lets you model real-world objects—even very complex ones—precisely and elegantly. As a result, object manipulation becomes easier and computer instructions become simpler and can be modified later with minimal effort.

Object-oriented programming hides any information that is not important for acting on an object, thereby concealing the object's complexities. Complex tasks can then be initiated simply, at a very high level.