Chapter 25 Key Takeaways
-
OO COBOL is real COBOL. The COBOL 2002 standard introduced a complete object model — classes, methods, inheritance, interfaces, and object references. This is not a toy feature; it is a fully specified extension of the language.
-
CLASS-ID replaces PROGRAM-ID as the identification paragraph for class definitions. Classes contain FACTORY and OBJECT sections, which hold class-level and instance-level data and methods, respectively.
-
The INVOKE statement is OO COBOL's method call mechanism, replacing Java's dot operator.
INVOKE obj "Method" USING params RETURNING resultis the fundamental pattern. -
SELF and SUPER reference the current object and the parent class's methods, analogous to
thisandsuperin Java. -
The REPOSITORY paragraph acts as a class registry, mapping logical class names to physical implementations — comparable to Java's import statements.
-
Inheritance uses the INHERITS clause. Override parent methods with
METHOD-ID. Name OVERRIDE.The OVERRIDE keyword is mandatory; implicit overriding is not allowed. -
Interfaces (INTERFACE-ID) define method contracts without implementations. Classes declare
IMPLEMENTS InterfaceNameto commit to providing those methods. -
Object references (
USAGE OBJECT REFERENCE) can be typed (class-specific), interface-typed, or untyped. Typed references provide compile-time checking; untyped references provide maximum flexibility. -
Adoption is limited. Micro Focus provides the most complete implementation. IBM Enterprise COBOL has partial support. GnuCOBOL has minimal support. This compiler reality constrains practical adoption.
-
OO thinking transcends OO syntax. Even without using OO COBOL syntax, you can apply encapsulation (through CALL interfaces), single responsibility (one program per function), and polymorphism (dispatcher patterns) in procedural COBOL.
-
The decision to adopt OO COBOL depends on compiler support, team skills, timeline constraints, and risk tolerance — not just on whether OO is "better" in the abstract. The human factor is decisive.
-
The Modernization Spectrum places OO COBOL between procedural COBOL and a full language migration. It offers genuine architectural improvement within the COBOL ecosystem, but limited community support and tooling make it a niche choice.