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. These actions are independent
of the data they operate on.
Modular program with isolated data
PROGRAM ...
___________________________
___________________________
PRINT _________________ |
_______________________ |
_______________________ | data
_______________________ | data data
___________________________ | data data
___________________________ | data data data
___________________________ | data data
SEND __________________ | data data
_______________________ | data
_______________________ |
_______________________ |
___________________________
___________________________
___________________________
ERASE _________________
_______________________
_______________________
_______________________
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.
Modular data--a report object
┌────────P R I N T────────┐
│ │
│ │
│ Report │
│ ------ │
S data F
E data I
N data L
D data E
│ data │
│ │
│ │
└────────E R A S E────────┘
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--potentially very complex ones--precisely and elegantly. As a result, object manipulation becomes easier within the computer's programming. Computer instructions become simpler, and can be modified later with minimal effort.
Object-oriented programming hides any information that need not be known in order to act on an object, thereby concealing the object's complexities. Complex tasks can then be initiated simply, at a very high level. It's like moving your arm. To do so, you do not have to know about the many electrical, chemical, and mechanical interactions that must occur in the bones, muscles, tissues, and systems involved. These operations occur at lower levels. You just move your arm.