A Classic Language Gets Classier

Object-oriented extensions have been added to traditional REXX without changing its existing functions and instructions. So you can continue to use REXX's procedural instructions, and incorporate objects as you become more comfortable with the technology. In general, your current REXX programs will work without change. But because Object REXX catches more errors at translate time than traditional REXX, you may have to fix these.

In object-oriented technology, objects are used in programs to model the real world. Similar objects are grouped into classes, and the classes themselves are arranged in hierarchies.

As an object-oriented programmer, you solve problems by identifying and classifying objects related to the problem. Then you determine what actions or behaviors will be required of those objects. Finally, you write the instructions to generate the classes, create the objects, and implement the actions. Your main program consists of instructions that send messages to objects.

A billing application, for example, might have an Invoice class and a Receipt class. These two classes might be members of a Forms class. Individual invoices are objects that are instances of the Invoice class.
Objects in a billing application

Forms class

┌───────────────┴───────────────┐
│ │
Invoice class Receipt class

invoice #1343
invoice #1344
invoice #1345

Each instance contains all the data associated with it (such as customer name, descriptions and prices of items purchased, and so on). To get at the data, you write instructions that send messages to the objects. These messages activate coded actions called methods. For an invoice object, you might want CREATE, DISPLAY, PRINT, UPDATE, and ERASE methods.


[Back: REXX and the OS/2 Operating System]
[Next: From Traditional REXX to Object REXX]