5.13.3. Object-Oriented Programming


Programs as collections of objects

Imagine that you have a large amount of information. You have a collection of computers, networked together, and plan to break the data into chunks, letting each computer store one chunk. Of course, you have some programs that work on the data as well, and a way for one computer to make requests of another computer. If program p works on the information in chunk i, then it makes sense to put p on the computer that stores that chunk rather than on some other computer.

Object-oriented programming can be thougt of as a way of using similar ideas within a single program. An object corresponds to one of the computers in the network. It holds a chunk of information and some methods that work on that information. You try to make the chunk sensible, containing a small amount of closely related information. The object's methods correspond to the programs on the networked computers. One object asks another to do something by using one of the other object's methods.

In the next chapter we look at the basics of object-oriented programming.