next up previous contents
Next: What Is a Computer? Up: Computers, Objects, and Java Previous: Why Java?

What Is Object-Oriented Programming?

An object is a program module that encapsulates some portion of a program's characteristics and behavior.

A Java program is a set of objects that interact with each other by sending and receiving messages among themselves.

One way to think about things is to imagine that when any kind of object is put into a Java program, it becomes alive and thereby able to act and communicate. Our CyberPet can tell us its name and respond to our commands. A button on the screen can tell us how big it is and whether it is visible or not. A calculator object can be given a number and asked to compute its square root.

Example of Interacting Objects. For example, suppose I want to order a piece of software from the Acme Computer Warehouse catalog. First I need to contact the catalog center and place my order. If I contact the catalog center by phone, I would carry on a conversation with a service agent, identifying the catalog number and description of the software I want to purchase. The agent might tell me how much it costs and ask for my credit card information, to which I would reply by providing my credit card number and expiration date.

Each of these transactions involves objects (mostly persons) interacting with each other by exchanging various kinds of information and then processing the information. The sales agent processes my order by passing it on, perhaps on a certain kind of form (another object), to a warehouse clerk (another object). The warehouse clerk uses the form to locate the software in the warehouse and passes it on, along with a delivery from, to a delivery dispatcher (another object). The dispatcher processes the delivery form by making arrangements with a courier (another object), and so on.

This transaction shows several characteristics that are important elements of object-oriented programming.

Taken together, these principles describe object-oriented programming and problem solving. Taken individually, each of the above principles provides a manifestation of the more general principle of abstraction .

Abstraction is the ability to group large quantities of information together into a single chunk. For example, its easier to remember a long string of digits if we chunk the digits. So a phone number gets organized into three chunks (200-990-1179), rather than one chunk consisting of ten digits (2009901179).


next up previous contents
Next: What Is a Computer? Up: Computers, Objects, and Java Previous: Why Java?
Ralph Morelli {Faculty}
6/25/1999