In object-oriented programming, objects are modeled to real-world objects. A real-world object has actions related to it and characteristics of its own.
Take a ball, for example. A ball can be acted on--rolled, tossed, thrown, bounced, caught. But it also has its own physical characteristics--size, shape, composition, weight, color, speed, position. An accurate data model of a real ball would define not only the physical characteristics but all related actions and characteristics in one package:
In object-oriented programming, objects are the basic building blocks--the fundamental units of data.
There are many kinds of objects; for example, character strings, collections, and input and output streams. An object--such as a character string--always consists of two parts: the possible actions or operations related to it, and its characteristics or variables. A variable has a variable name, and an associated data value that can change over time. These actions and characteristics are so closely associated that they cannot be separated:
To access an object's data, you must always specify an action. For example, suppose the object is the number 5. Its actions might include addition, subtraction, multiplication, and division. Each of these actions is an interface to the object's data. The data is said to be encapsulated because the only way to access it is through one of these surrounding actions. The encapsulated internal characteristics of an object are its variables. Variables are associated with an object and exist for the lifetime of that object:
Rexx comes with a basic set of classes for creating objects (see Objects and Classes). Therefore, you can create objects that exactly match the needs of a particular application.