Objects as Multiple Entities

One of the pitfalls for procedural programmers is that of thinking of a data structure in a program as representing a single entity. A perfect example of this is the display screen. Usually, procedural programs tend to write something to the (one) screen. The problem with this method is that when you switch to a windowing environment and have to write to multiple screens, the whole program is in jeopardy. It takes a lot of work to go back and change the program so that the correct data is written to the appropriate window.

In contrast, OOP programming simplifies the task of treating the screen not as the screen but as a screen. Adding windows is as simple as telling an output method which screen object to use.

This ...

Get Special Edition Using Java 2 Standard Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.