---
rexxpub:
  defaults: rony.yaml
  logo: oorexx
---

<!-- 050_ooRexx_V08.odp (2026-10-15 09:35) -->

<!-- slide # 1 (2026-10-15 09:35) ----------------------------- ODP slide # 1 -->
. slide cover
# Procedural and Object-oriented Programming 5

. subtitle
**Defining Classes ("CLASS" Directive), Defining Methods ("METHOD" Directive),**\
**Object Rexx Classes**

. cover-art
. picture img/050_ooRexx_V08/p01-diagram-7.png

<!-- slide # 2 (2026-10-15 09:35) ----------------------------- ODP slide # 2 -->
. slide reference="Cf. rexxref.pdf (3.3. ::CLASS)"
# Abstract Datatype (ADT)

. after steps
- Implementing an ADT schema with ooRexx
    - `::CLASS`{.rexx} directive
        - Definition of **attributes** (fields) and therefore the internal datastructure
            - `::ATTRIBUTE`{.rexx} directive
            - **EXPOSE** statement denoting attributes (fields) ***within*** method routines
        - Definition of **operations** (method routines)
            . after
            - `::METHOD`{.rexx} directive
- Instances ("values", "objects") of datatypes ("classes", "types")
    . static
    - Individual, unambiguously distinguishible instances of the same type
    - Possess all the same attributes (constitute the datastructure as defined in the class) and operations ("methods of the class")

<!-- slide # 3 (2026-10-15 09:35) ----------------------------- ODP slide # 3 -->
. slide reference="Cf. rexxref.pdf (1.11.4. Message Terms)"
# Object Rexx Messages

. after steps
- Conceptually, objects are regarded to be living things in ooRexx with which one communicates using messages! :)
    - If an object receives a message (with or without arguments) it
        . after
        - Searches for a method by the name of the received message in its class
            - If found, it invokes the method, supplying the received message arguments, if any, and returns any value the method may have returned
            - If not found the object searches the class hierarchy to find and invoke the method as described above
                - If there is no method found by the object it will raise a runtime condition with the error message `"Object does not understand message"` and the interpreter stops the execution of the program
    - A message consists at least of the receiving object, the message operator (**\~**) and the message name to be sent to the object, e.g.

      . click
      ```rexx
      object = .birthday~new
      ```

<!-- slide # 4 (2026-10-15 09:35) ----------------------------- ODP slide # 4 -->
. slide reference="Cf. rexxref.pdf (1.11.4. Message Terms)"
# Object Rexx Messages

. steps
. static
- Interaction (activating of methods) with objects (instances, values) is *only* possible via messages
    - Names of messages are the names of the methods, that the object must find and invoke on behalf of the programmer
    - Message operator ("twiddle") is the tilde character: **\~**
        . static
        - `"ABC"~REVERSE`{.rexx} yields: `CBA`
    - "Cascading" messages, two twiddles: **\~\~**
        . static
        - `"ABC"~~REVERSE`{.rexx} yields (*attention!*): `ABC`
        - Sent messages activate the respective methods of the receiving object, upon return the interpreter changes the result to be *always* the receiving object!
            - Therefore multiple messages intended for the same object can be "cascaded" one after the other ("cascading messages)
    - Execution (resolution) of messages: from left to right

<!-- slide # 5 (2026-10-15 09:35) ----------------------------- ODP slide # 5 -->
. slide reference="Cf. rexxref.pdf (1.11.4. Message Terms)"
# Using of an Abstract Datatype (ADT), 1

- Object Rexx implementation of the ADT **Birthday**

  ```rexx
  /**/
  g1 = .Birthday~New
  g1~Date= "20320901"
  g1~Time= "16:00"
  g2=.Birthday~New~~"Date="("20360229")~~"Time="("19:19")
  SAY g1~date g2~date g1~time g2~time

  ::CLASS  Birthday
  ::ATTRIBUTE date
  ::ATTRIBUTE time
  ```

  . click label
  Output:

  . after
  ```output
  20320901 20360229 16:00 19:19
  ```

<!-- slide # 6 (2026-10-15 09:35) ----------------------------- ODP slide # 6 -->
# Overview of Scopes

. after
- Rexx und Object Rexx
    . after
    - Standard scope
        - Labels, variables
    . after
    - Procedure scope
        - Variables in internal routines (procedures/functions)
. after
- Object Rexx
    . after
    - Program/Package scope
        - Accessing local and public classes and routines of called/required programs
    . after
    - Routine scope
        - Standard+procedure+program/package scope
    . after
    - Method scope
        - Standard+procedure+program plus accessibility of attributes
            - Methods assigned to a class: methods, which are defined for a class ("instance/object attributes")
            - Floating methods: methods, that are defined before any class directive ("floating attributes")

<!-- slide # 7 (2026-10-15 09:35) ----------------------------- ODP slide # 7 -->
. slide reference="Cf. rexxref.pdf (4.2.9. Initialization)"
# Creating Objects

. steps
. static
- Creating (constructing) a new object (value, instance) can be done by sending the **NEW** message to a class
    - The **NEW** method will create the new object (instance, value) and will send it the message **INIT** to allow it to initialise
        - If the **NEW** message has arguments, they get forwarded with the **INIT** message in the same order
    - The **NEW** method returns the reference to the newly created object (instance, value) as its result
- Hence, if we define an **INIT** method for a class, we can use it to initialise an object immediately after it got created (constructed)
    . after
    - The **INIT** method is therefore also called "***constructor***"
    . after
    - Always invoke the **INIT** method of the superclass!

<!-- slide # 8 (2026-10-15 09:35) ----------------------------- ODP slide # 8 -->
. slide kicker="Abstract Datatype “Person”, #" reference="Cf. rexxref.pdf (4.2.9. Initialization)"
# Constructor: Method INIT

. after mark 7-10 pen=1
. after mark 2-3 pen=1
```rexx
/**/
p1 = .Person~New("Albert","Einstein","45000")
p2 = .Person~New("Vera","Withanyname",25000)
SAY p1~firstName p1~familyName p1~salary p2~firstName
SAY p1~firstName p1~salary p1~~increaseSalary(10000)~salary
::CLASS  Person
::METHOD INIT
  EXPOSE  firstName familyName salary
  USE ARG firstName, familyName, salary
  self~init:super -- invoke constructor of superclass
::ATTRIBUTE firstName
::ATTRIBUTE familyName
::ATTRIBUTE salary
::METHOD increaseSalary
  EXPOSE salary
  USE ARG increase
  salary = salary + increase
```

. click label
Output:

. after
```output
Albert Einstein 45000 Vera
Albert 45000 55000
```

<!-- slide # 9 (2026-10-15 09:35) ----------------------------- ODP slide # 9 -->
. slide reference="Cf. rexxref.pdf (4.2.10. Object Destruction and Uninitialization)"
# Deleting of Objects

- Objects are automatically deleted from the runtime system, if they are not referenced anymore (becoming "garbage")
    . click
    - *If* there is a method named **UNINIT** defined for a class, then this method will be invoked, right before the unreferenced object gets destructed by the garbage collector by sendig it the **UNINIT** message.
. click
- The **UNINIT** method is therefore called "***destructor***"

<!-- slide # 10 (2026-10-15 09:35) --------------------------- ODP slide # 10 -->
. slide kicker="Abstract Datatype “Person”"
# Destructor: Method UNINIT

. after mark 12-14 pen=1
. after mark 6 pen=2
```rexx
/**/
p1 = .Person~New("Albert","Einstein","45000")
p2 = .Person~New("Vera","Withanyname",25000)
SAY p1~firstName p1~familyName p1~salary p2~firstName
SAY p1~firstName p1~salary p1~~increaseSalary(10000)~salary
DROP p1; DROP p2; CALL SysSleep( 15 ); SAY "Finish."
::CLASS  Person
::METHOD INIT
  EXPOSE  firstName familyName salary
  USE ARG firstName, familyName, salary
  self~init:super -- invoke constructor of superclass
::METHOD UNINIT
  EXPOSE  firstName familyName salary
  SAY  "Object: <"firstName familyName salary"> is about to be destroyed."
::ATTRIBUTE firstName
::ATTRIBUTE familyName
::ATTRIBUTE salary
::METHOD increaseSalary
  EXPOSE salary
  USE ARG increase
  salary = salary + increase
```

. click label
Output:

. after group id=#p10x15

. mark id=#h3 3-5
. numbered steps=3,4,5 each=after
```output
Albert Einstein 45000 Vera
Albert 45000 55000
Finish.
Object: <Vera Withanyname 25000> is about to be destroyed.
Object: <Albert Einstein 55000> is about to be destroyed.
```

. after show #h3 pen=3

. with callout --> #p10x15:3-5 at=right
Sequence can be different on different runs!

. end group

<!-- slide # 11 (2026-10-15 09:35) --------------------------- ODP slide # 11 -->
# Classification Tree

. steps
. static
- Generalization Hierarchy, "Classification Tree"
    - Allows **classification of instances** (Objects), e.g. from biology
    - **Ordering of classes in superclasses and subclasses** (schemata)
        . after
        - Subordered classes ("subclasses") **inherit** all properties (attributes and methods) of all superclasses up to and including the root class
        - Subclasses **specialize** in one way or the other the superclass(es)
            . after
            - "Defining of differences": simplifies the definition of subclasses
    - Sometimes it may make sense, that a subclass specializes directly more than one superclass at the same time ("**multiple inheritance**")
        - Example: Classes representing landborne and waterborne animals, where there exists a class "amphibians", which inherits directly from the landborne and waterborne animals

<!-- slide # 12 (2026-10-15 09:35) --------------------------- ODP slide # 12 -->
# Classification Tree

. after steps
- Prefabricated "class tree"
    - Root class of Object Rexx is named **Object**
    - All user defined classes are assumed to specialize the class **Object**, if no superclass is explicitly given
    - Single and multiple inheritance possible

<!-- slide # 13 (2026-10-15 09:35) --------------------------- ODP slide # 13 -->
# Classification Tree: Search Order

. after steps
- Conceptually, the object receiving a message, starts searching for a method by the name of the received message and if found invokes it with the supplied arguments
- If such a method is not found in the class, from which the object is created, then the search is continued in the direct superclass up to and including the root class **Object**
- If the method is not even found in the root class **Object**, then an error condition gets thrown (`"Object does not understand message"`)
    - If there is a method named **UNKNOWN** defined, then instead of creating an exception the runtime system will invoke that method, supplying the name of the unknown method and its arguments, if any were supplied with the message

<!-- slide # 14 (2026-10-15 09:35) --------------------------- ODP slide # 14 -->
# Classification Tree: Search Order

. after
- In method routines ooRexx sets the following two variables which are therefore *always available in methods*
    . click
    - **super**
        - Always contains a reference to the immediate superclass
        - Allows redirecting the search for methods to the immediate superclass
    . click
    - **self**
        - Always contains a reference to the object for which the method got invoked
        - This way it becomes possible to send messages to the object from within a method
. click
- **super** and **self** determine the class, where the search for methods with the message name starts

<!-- slide # 15 (2026-10-15 09:35) --------------------------- ODP slide # 15 -->
# Example "Dog"

. steps each=after
. static
- Problem description
    . click
    - "Special Interest Group (SIG) Dog Sanctuary"
        - Normal dogs
        - Little dogs
        - Big dogs
    . click
    - All dogs possess a name and are able to bark
        - Normal dogs bark "**Wuff Wuff**"
        - Little dogs bark "**wuuf**"
        - Big dogs bark "**WUFFF! WUFFF!! WUFFF!!!**"
    . click
    - Define appropriate classes taking advantage of inheritance (search order)

<!-- slide # 16 (2026-10-15 09:35) --------------------------- ODP slide # 16 -->
. slide reference="Cf. rexxref.pdf (4.2.9. Initialization)"
# Example "Dog"

- Definition of a class "**LittleDog**", which possesses all properties common to all little dogs

  . after mark 5 9 13 pen=1
  . after mark 12 pen=1
  ```rexx
  /**/
  .Dog~NEW       ~~"NAME="("Sweety")  ~Bark
  .BigDog~NEW    ~~"NAME="("Grobian") ~Bark
  .LittleDog~NEW ~~"NAME="("Arnie")   ~Bark
  ::CLASS  Dog          SUBCLASS Object
  ::ATTRIBUTE Name
  ::METHOD Bark
    SAY self~Name":" "Wuff Wuff" "-" self
  ::CLASS  BigDog   SUBCLASS dog
  ::METHOD Bark
    SAY self~Name":" "WUFFF! WUFFF!! WUFFF!!!" "-" self
    self~bark:super
  ::CLASS  "LittleDog" SUBCLASS dog
  ::METHOD Bark
    SAY self~Name":" "wuuf" "-" self
  ```

  . click label
  Output:

  . after
  . after mark 3 pen=2
  ```output
  Sweety: Wuff Wuff - a DOG
  Grobian: WUFFF! WUFFF!! WUFFF!!! - a BIGDOG
  Grobian: Wuff Wuff - a BIGDOG
  Arnie: wuuf - a LittleDog
  ```

<!-- slide # 17 (2026-10-15 09:35) --------------------------- ODP slide # 17 -->
# Multithreading

. after
- Multithreading
    - Multiple parts of a program execute at the same time (in parallel)
    . click
    - Possible problems
        - Data integrity (Object integrity)
        - Deadlocks
. click
- Object Rexx
    . click
    - **Inter** Object-Multithreading
        - Different objects (even of one and the same class) are shielded from each other and can be active at the same time
    . click
    - **Intra** Object-Multithreading
        - ***Within*** an instance (an object) multiple methods can execute at the same time, if they are defined in *different classes*

<!-- slide # 18 (2026-10-15 09:35) --------------------------- ODP slide # 18 -->
. slide reference="Cf. rexxref.pdf (3.3. ::CLASS)"
# ::CLASS Directive

- This directive causes the interpreter to create a class
    . click
    - `::CLASS xyz`{.rexx}
        - A class with the name  **XYZ** is created
. click
- The following options are available for this directive
    . after
    - **PRIVATE, PUBLIC**
        - Optional, default value: **PRIVATE**
    . click
    - **SUBCLASS, MIXINCLASS**
        - Optional, default value: **SUBCLASS Object**
    . click
    - **METACLASS** metaclass
        - Optional, default value: **METACLASS Class**
    . click
    - **INHERIT**
        - Optional, allows indicating those classes which are inherited in addition: multiple inheritance

<!-- slide # 19 (2026-10-15 09:35) --------------------------- ODP slide # 19 -->
. slide reference="Cf. rexxref.pdf (3.3. ::CLASS)"
# ::CLASS Directive, 1
# Implementing "Vehicle",  "RoadVehicle", "WaterVehicle"

```rexx
/**/
.RoadVehicle  ~new("Truck") ~drive
.WaterVehicle ~new("Boat")  ~swim

::CLASS     Vehicle
::ATTRIBUTE name
::METHOD    INIT
  self~name = ARG(1)

::CLASS     RoadVehicle   SUBCLASS Vehicle
::METHOD    drive
  SAY self~name": 'I drive now...'"

::CLASS     WaterVehicle  SUBCLASS Vehicle
::METHOD    swim
  SAY self~name": 'I swim now...'"
```

. click label
Output:

. after
```output
Truck: 'I drive now...'
Boat: 'I swim now...'
```

<!-- slide # 20 (2026-10-15 09:35) --------------------------- ODP slide # 20 -->
. slide reference="Cf. rexxref.pdf (3.3. ::CLASS)"
# ::CLASS Directive, 2
# Implementing "AmphibianVehicle" Using Multiple Inheritance

. click mark 13 "MIXINCLASS" pen=1
. with mark 17 "MIXINCLASS" pen=1
. after mark 21 "INHERIT WaterVehicle" pen=1
. after mark 23 pen=1
```rexx
/* Multiple Inheritance */
.RoadVehicle      ~new("Truck")   ~drive
.WaterVehicle     ~new("Boat")    ~swim
.AmphibianVehicle ~new("SwimCar") ~show_off

::CLASS     Vehicle
::ATTRIBUTE name
::METHOD    INIT
  self~name = ARG(1)
::METHOD    tsk
  SAY self~name": 'tsk!'"

::CLASS     RoadVehicle  MIXINCLASS Vehicle
::METHOD    drive
  SAY self~name": 'I drive now...'"

::CLASS     WaterVehicle MIXINCLASS Vehicle
::METHOD    swim
  SAY self~name": 'I swim now...'"

::CLASS     AmphibianVehicle SUBCLASS RoadVehicle INHERIT WaterVehicle
::METHOD    show_off
  self ~~drive ~~swim ~~tsk
```

. click label
Output:

. with
. after mark 3-5 pen=2
```output
Truck: 'I drive now...'
Boat: 'I swim now...'
SwimCar: 'I drive now...'
SwimCar: 'I swim now...'
SwimCar: 'tsk!'
```

<!-- slide # 21 (2026-10-15 09:35) --------------------------- ODP slide # 21 -->
. slide reference="Cf. rexxref.pdf (3.3. ::CLASS)"
# ::CLASS Directive, 3
# *AmphibianVehicle*'s Search Order Because of Using Multiple Inheritance

. drawing id=#p21d16 ratio=2.19 width=77% size=1.61
. after box id=#p21x17 anim=fade at=30.8,0,25.6,16.9
Vehicle

. with box id=#p21x18 anim=fade at=0,43.8,33.3,11.2
RoadVehicle

. with box id=#p21x19 anim=fade at=58.4,43.8,33.3,11.2
WaterVehicle

. with arrow #p21x17 -- #p21x19 anim=fade route=elbow

. with arrow #p21x17 -- #p21x18 anim=fade route=elbow

. click box id=#p21x20 anim=fade at=26.7,88.8,33.3,11.2
AmphibianVehicle

. with arrow #p21x19 -- #p21x20 anim=fade route=elbow

. with arrow #p21x18 -- #p21x20 anim=fade route=elbow

. click arrow #p21x20 -> #p21x18 line=dashed color=#c9211e

. after id=#p21x24 at=10.3,74.3,17.9,10 style="color: #c9211e; font-size: 1.41em"
**subclass**

. after arrow #p21x18 -> #p21x19 line=dashed color=#c9211e

. after id=#p21x25 at=35.9,37.2,17.9,10 style="color: #c9211e; font-size: 1.41em"
**inherit**

. after arrow #p21x19 -> #p21x17 line=dashed color=#c9211e

. click box arrow=left id=#p21x21 at=25.7,62.8,19.5,16.9 style="rotate: 28.0deg; font-size: 1.21em"
**MixinClass**

. after box arrow=left id=#p21x23 at=80.2,61.6,19.1,16.9 style="rotate: 28.0deg; font-size: 1.21em"
**MixinClass**

. after box arrow=left id=#p21x22 at=58.7,0,20.5,16.9 style="font-size: 1.21em"
**BaseClass**

. end drawing

<!-- slide # 22 (2026-10-15 09:35) --------------------------- ODP slide # 22 -->
. slide reference="Cf. rexxref.pdf (3.5. ::METHOD)"
# ::METHOD Directive

- This directive causes the interpreter to create a method
    - `::Method mmm`{.rexx}
        - A method with the identifier "**MMM**" is created
. click
- The following options are available for this directive
    - **ATTRIBUTE**
        - Optional, if supplied the interpreter creates **two** methods:
            . click
            - A get ("getter") method "**MMM**" (returns the attribute's value) like this

              . after
              ```rexx
              ::METHOD  MMM   /* name of get method "MMM"               */
                EXPOSE  MMM   /* allow direct access to the attribute   */
                RETURN  MMM   /* return the attribute's value           */
              ```

            . click
            - A set ("setter") method "**MMM=**" (sets the attribute's value to the supplied argument) like this

              . after
              ```rexx
              ::METHOD "MMM=" /* name of the set method "MMM="          */
                EXPOSE  MMM   /* allow direct access to the attribute   */
                USE ARG MMM   /* retrieve argument and assign it to the attribute */
              ```

<!-- slide # 23 (2026-10-15 09:35) --------------------------- ODP slide # 23 -->
. slide reference="Cf. rexxref.pdf (3.2. ::ATTRIBUTE)"
# ::METHOD Directive

- The following options are available for this directive (continued)
    . after
    - **PRIVATE, PUBLIC**
        - Optional, default value: **PUBLIC**
        - If set to **PRIVATE**  then the message can only be sent as: **self\~mmm**
    . click
    - **GUARDED, UNGUARDED**
        - Optional, default value: **GUARDED**
        - Determines whether method can be run in parallel to other methods
    . click
    - **CLASS**
        - Optional, method is a class method
    . click
    - **PROTECTED, UNPROTECTED**
        - Optional, default value: **UNPROTECTED**
        - If set to **PROTECTED** then access to this method can be supervised with the help of the Object Rexx *Security Manager*

<!-- slide # 24 (2026-10-15 09:35) --------------------------- ODP slide # 24 -->
. slide reference="Cf. rexxref.pdf (3.2. ::ATTRIBUTE)"
# ::ATTRIBUTE Directive

. steps
. static
- `::ATTRIBUTE`{.rexx} **mmm \[GET|SET\]**
    - This directive is equivalent to "`::METHOD mmm ATTRIBUTE`{.rexx}" and causes the interpreter to create the following two methods by default:
        - A getter method named `"MMM"` and
        . after
        - A setter method named **"MMM="**
    - If the option **GET** is given, then only the getter method gets created
    - If the option **SET** is given, then only the setter method gets created

<!-- slide # 25 (2026-10-15 09:35) --------------------------- ODP slide # 25 -->
. slide reference="Cf. rexxref.pdf (3.4. ::CONSTANT)"
# ::CONSTANT Directive

- `::CONSTANT NAME VALUE`{.rexx}
    - This directive creates a class and an instance method named **NAME** which always returns **VALUE**

      . click
      ```rexx
      say "pi:" .MyClass~pi "(from class)"
      o=.MyClass~new
      say "pi:" o~pi "(from instance)"

      ::CLASS MyClass
      ::CONSTANT pi 3.141592653589793238462643383279502884197
      ```

      . click label
      Output:

      . after
      ```output
      pi: 3.141592653589793238462643383279502884197 (from class)
      pi: 3.141592653589793238462643383279502884197 (from instance)
      ```

<!-- slide # 26 (2026-10-15 09:35) --------------------------- ODP slide # 26 -->
. slide reference="Cf. rexxref.pdf (3.8. ::RESOURCE)"
# ::RESOURCE Directive

. steps each=after
. static
- `::RESOURCE NAME`
    - By default this directive needs as delimiter the string **"::END"** starting at the first column of one of the following lines
        . click
        - The end marker string can be changed using the **END delimiter** option of the directive
    . click
    - All lines between the start and the end of the directive will be stored in an array
    - This array will be stored using **NAME** as its index in the **.RESOURCES StringTable**
. click
- Fetching a resource in the program
    - Send **NAME** as the message to the **.RESOURCES StringTable**
        - Returns an array of text lines representing the named resource
            - To turn an array back into a plain string, send the array the **makeString** or the **toString**  message
            - The **SAY** keyword statement will automatically request the string representation

<!-- slide # 27 (2026-10-15 09:35) --------------------------- ODP slide # 27 -->
. slide reference="Cf. rexxref.pdf (3.8. ::RESOURCE)"
# ::RESOURCE Directive

. steps each=after
- The **RESOURCE** directive makes it easy to define and use multi line strings
    - No need to enquote and concatenate strings spanning multiple lines
. click
- Resources can be used among other things for e.g.
    - Multiline SQL queries
    - XML/HTML chunks to serve client requests in web server applications
    - Any kind of multiline text
    - *Base64* encoded binary data like pictures, sound, cryptographic keys, …
        - Cf. the methods of the **String** class named **encodeBase64** and **decodeBase64**

<!-- slide # 28 (2026-10-15 09:35) --------------------------- ODP slide # 28 -->
. slide reference="Cf. rexxref.pdf (3.8. ::RESOURCE)"
# ::RESOURCE Directive

```rexx
say "resource named 'info':"
say .resources~info

::resource info
*******************************************************
*                                                     *
* This is the secret:                                 *
*                                                     *
*     Eat an apple a day to keep the doctor away! ;)  *
*                                                     *
*******************************************************
::END
```

. click label
Output:

. after
```output
resource named 'info':
*******************************************************
*                                                     *
* This is the secret:                                 *
*                                                     *
*     Eat an apple a day to keep the doctor away! ;)  *
*                                                     *
*******************************************************
```

<!-- slide # 29 (2026-10-15 09:35) --------------------------- ODP slide # 29 -->
. slide kicker="Classification Tree (ooRexx 3.1)" reference="Cf. rexxref.pdf (5. Builtin Classes)"
# Fundamental Classes

. mark id=#t1 "Object" "Class" "Method" "Message"
. tree layout=columns flow=4
- Object
  - Class
  - Method
  - Message
  - Alarm
  - Monitor
  . break
  - String
  - Stem
  - Stream
  - MutableBuffer
  . break
  - Array
  - List
  - Queue
    . under
    - CircularQueue
  - Supplier
  . break
  - Directory
  - Relation
    - Bag
  - Table
    - Set

. after show #t1 hull label="Fundamental Classes"

<!-- slide # 30 (2026-10-15 09:35) --------------------------- ODP slide # 30 -->
. slide kicker="Classification Tree" reference="Cf. rexxref.pdf (5.1.1. Class Class, 5.1.4. Object Class)"
# Fundamental Classes

- **Object**
    . with
    - Methods and attributes are available to all instances (**objects**, **values**) of any Rexx class
        . click
        - Example: method **INIT**
            - Constructor, initializes a newly created object
. click
- **Class**
    - Interpreter creates an instance of this class ("**class object**") for each `::CLASS`{.rexx} directive
        . click
        - Example: method **ID**
            - Returns the name (the "**id**entification") of the class object
        . after
        - Example: method **NEW**
            - Creates a new instance (object, value) of the class, sends it the **INIT** message and returns it

<!-- slide # 31 (2026-10-15 09:35) --------------------------- ODP slide # 31 -->
. slide kicker="Classification Tree" reference="Cf. rexxref.pdf (5.1.3. Method Class, 5.1.2. Message Class)"
# Fundamental Classes

- **Method**
    . after
    - Interpreter creates an instance of this class ("**method object**") for each `::METHOD`{.rexx} directive
        . click
        - Example: method **SOURCE**
            - Returns the source code of the method, if available
. click
- **Message**
    . after
    - For each message at runtime the interpreter creates an instance of this class ("**message object**")
        . click
        - Example: method **SEND**
            - Sends (transmits, dispatches) the message to the object and waits until it got processed

<!-- slide # 32 (2026-10-15 09:35) --------------------------- ODP slide # 32 -->
. slide kicker="Classification Tree (ooRexx 3.1)" reference="Cf. rexxref.pdf (5. Builtin Classes)"
# Alarm Class

. mark id=#t1 "Alarm"
. tree layout=columns flow=4
- Object
  - Class
  - Method
  - Message
  - Alarm
  - Monitor
  . break
  - String
  - Stem
  - Stream
  - MutableBuffer
  . break
  - Array
  - List
  - Queue
    . under
    - CircularQueue
  - Supplier
  . break
  - Directory
  - Relation
    - Bag
  - Table
    - Set

. after show #t1

<!-- slide # 33 (2026-10-15 09:35) --------------------------- ODP slide # 33 -->
. slide kicker="Classification Tree" reference="Cf. rexxref.pdf (5.4.1. Alarm Class)"
# Alarm Class

- **Alarm**
    . after
    - Alarm objects allow dispatching messages at a later time
        . after
        - Such messages are carried out in parallel to other activities in the Object Rexx program ("multithreaded execution")
        . click
        - Dispatch time can be given
            - In hours, minutes, seconds starting from the time of initialization of the alarm object
            - As date and time
    . click
    - Example: method **CANCEL**
        - Cancels an alarm object, the pending message will not be dispatched

<!-- slide # 34 (2026-10-15 09:35) --------------------------- ODP slide # 34 -->
. slide kicker="Classification Tree (ooRexx 3.1)" reference="Cf. rexxref.pdf (5. Builtin Classes)"
# Monitor Class

. mark id=#t1 "Monitor"
. tree layout=columns flow=4
- Object
  - Class
  - Method
  - Message
  - Alarm
  - Monitor
  . break
  - String
  - Stem
  - Stream
  - MutableBuffer
  . break
  - Array
  - List
  - Queue
    . under
    - CircularQueue
  - Supplier
  . break
  - Directory
  - Relation
    - Bag
  - Table
    - Set

. after show #t1

<!-- slide # 35 (2026-10-15 09:35) --------------------------- ODP slide # 35 -->
. slide kicker="Classification Tree" reference="Cf. rexxref.pdf (5.4.10. Monitor Class)"
# Monitor Class

- **Monitor**
    . after
    - Monitor objects allow the monitoring of messages sent to objects
        . click
        - Example: method **CURRENT**
            - Returns the currently monitored object
        . click
        - Example: method **DESTINATION**
            - Allows to change the destination of the monitor
    . click
    - Hint: ooRexx uses monitors in its **.local** environment directory
        . click
        - **.input** monitors **.stdin**, the ooRexx *stdin* stream object
        . after
        - **.output** monitors **.stdout**, the ooRexx *stdout* stream object
        . after
        - **.error** monitors **.stderr**, the ooRexx *stderr* stream object

<!-- slide # 36 (2026-10-15 09:35) --------------------------- ODP slide # 36 -->
. slide kicker="Classification Tree (ooRexx 3.1)" reference="Cf. rexxref.pdf (5. Builtin Classes)"
# “Classic Rexx” Classes

. mark id=#t1 "String" "Stem" "Stream"
. tree layout=columns flow=4
- Object
  - Class
  - Method
  - Message
  - Alarm
  - Monitor
  . break
  - String
  - Stem
  - Stream
  - MutableBuffer
  . break
  - Array
  - List
  - Queue
    . under
    - CircularQueue
  - Supplier
  . break
  - Directory
  - Relation
    - Bag
  - Table
    - Set

. after show #t1 hull label="Classic Rexx Classes"

<!-- slide # 37 (2026-10-15 09:35) --------------------------- ODP slide # 37 -->
. slide kicker="Classification Tree" reference="Cf. rexxref.pdf (5.1.7. String Class)"
# “Classic Rexx” Classes

- **String**
    . after
    - String objects possess all methods, which are the counterparts of all string functions in classic Rexx
        . click
        - **Distinctive feature:** string objects never change the value they were created with!

. click level=1
```rexx
a = .string~new("hallo")      /* a new string object                */
a = "hallo"              /* a new string object with a value of "hallo" */
a = "aloha"              /* a new string object with a value of "aloha" */
a = "aloha"              /* a new string object with a value of "aloha" */

a = "a" || "b"           /* a new string object with a value of "ab"    */
a = a   || "b"           /* a new string object with a value of "abb"   */

a = 1 + 3                /* a new string object with a value of "4"     */
a = a + 3                /* a new string object with a value of "7"     */
```

<!-- slide # 38 (2026-10-15 09:35) --------------------------- ODP slide # 38 -->
. slide kicker="Classification Tree" reference="Cf. rexxref.pdf (5.1.7. String Class)"
# “Classic Rexx” Classes

- **String**
    . after
    - String functions will be transformed "behind the curtain" by Object Rexx into the appropriate object-oriented version, by sending the appropriate messages to the string object!
        . click
        - Example: method **REVERSE**
            . after
            - Reverses the sequence of characters in a string

. click level=2
```rexx
SAY REVERSE("d:\path\datei.typ") /* function */
SAY "d:\path\datei.typ"~REVERSE  /* message  */
```

. click label level=2
Output:

. after level=2
```output
pyt.ietad\htap\:d
pyt.ietad\htap\:d
```

<!-- slide # 39 (2026-10-15 09:35) --------------------------- ODP slide # 39 -->
. slide kicker="Classification Tree" reference="Cf. rexxref.pdf (5.3.16. Stem Class)"
# “Classic Rexx” Classes

- **Stem**
    - Stem objects allow any string to be used as an index
        - The stem of the identifier includes the first dot

. click level=2
```rexx
a.2 = "I am a.2"
SAY a.1.b "/and\" a.2
```

. with level=2
```output
A.1.B /and\ I am a.2
```

. click level=2
```rexx
a.  = "no value"
a.2 = "I am a.2"
SAY a.1.b "/and\" a.2
```

. with level=2
```output
no value /and\ I am a.2
```

. click level=2
```rexx
a = .stem~new("no value") /* new stem object */
a[2] = "I am a.2"
SAY a[a.1.b] "/and\" a[2]
```

. with level=2
```output
no valueno value /and\ I am a.2
```

<!-- slide # 40 (2026-10-15 09:35) --------------------------- ODP slide # 40 -->
. slide kicker="Classification Tree" reference="Cf. rexxref.pdf (5.3.16. Stem Class)"
# “Classic Rexx” Classes

- **Stem**
    - Stem objects allow the collection of arbitrary objects with the help of string indices
        - Example: methods **\[\]** and **\[\]=**

. level=2
```rexx
DROP a a. b b. /* Make sure that variables are deleted */
a = .stem~new("xyz")
a["holladi"] = "Entry for 'holla.di'"
b. = a /* two references to the same stem object!  */
b.di.di.dumm = "Entry for 'DI.DI.DUMM'"
SAY "1:" a["holladi"]      "/and\" a~"[]"("DI.DI.DUMM")
tmp1 = "holladi"; tmp2 = "DI.DI.DUMM"
SAY "2:" a.tmp1            "/and\" a.[tmp2]
SAY "3:" b.tmp1            "/and\" b.[tmp2]
SAY "4:" a a. a.Unknown b b. b.Unknown a[Unknown]
```

. click label level=2
Output:

. after level=2
```output
1: Entry for 'holla.di' /and\ Entry for 'DI.DI.DUMM'
2: A.holladi /and\ A.DI.DI.DUMM
3: Entry for 'holla.di' /and\ Entry for 'DI.DI.DUMM'
4: xyz A. A.UNKNOWN B xyz xyzUNKNOWN xyzUNKNOWN
```

<!-- slide # 41 (2026-10-15 09:35) --------------------------- ODP slide # 41 -->
. slide kicker="Classification Tree" reference="Cf. rexxref.pdf (5.2.4. Stream Class)"
# “Classic Rexx” Classes

- **Stream**
    . after
    - Stream objects allow working with files (and communication devices)
        . click
        - Example: method **NEW**

          . after
          ```rexx
          o = .stream ~NEW("test.dat")
          ```

            . click
            - Allows working with the file **test.dat** by sending the stream object ***o*** the appropriate messages, e.g. **OPEN** for opening, **LINEIN** (**CHARIN**) for reading from the file, **LINEOUT** (**CHAROUT**) for writing to the file, **CLOSE** for closing

<!-- slide # 42 (2026-10-15 09:35) --------------------------- ODP slide # 42 -->
. slide kicker="Classification Tree (ooRexx 3.1)" reference="Cf. rexxref.pdf (5. Builtin Classes)"
# MutableBuffer Class

. mark id=#t1 "MutableBuffer"
. tree layout=columns flow=4
- Object
  - Class
  - Method
  - Message
  - Alarm
  - Monitor
  . break
  - String
  - Stem
  - Stream
  - MutableBuffer
  . break
  - Array
  - List
  - Queue
    . under
    - CircularQueue
  - Supplier
  . break
  - Directory
  - Relation
    - Bag
  - Table
    - Set

. after show #t1

<!-- slide # 43 (2026-10-15 09:35) --------------------------- ODP slide # 43 -->
. slide kicker="Classification Tree" reference="Cf. rexxref.pdf (5.4.11. MutableBuffer Class)"
# MutableBuffer Class

. steps each=after
. static
- **MutableBuffer**
    - Class that allows to create a buffer from many little strings quickly
        - Comparable to Java's *StringBuffer* or *StringBuilder* classes
    . click
    - Example methods
        - Method **APPEND**
            - Appends a string chunk to the buffer
        . click
        - Method **STRING**
            - Renders the current buffer as a single string object and returns it

<!-- slide # 44 (2026-10-15 09:35) ----------- business card (not in the ODP) -->
. slide card logo=none
# Contact