There are over 400 warships in the US Navy… Only two of them are named in honor of a woman One of them is named the USS Hopper
The NE e RS R C ( C Nati Na ona n l Ene En rgy r Res R ear ea c r h h Scienti ien fic fic Compu p tin ti g n Cent Cen er t ) er firs fir t s Cra r y a XE6 6 pe p t e a t flop a sup u erc er o c mput u er t is is na n med Ho H p o per
Rear Admiral Grace Murray Hopper (December 9, 1906 – January 1, 1992) Grace Hopper, was a pioneer in the field of software development and programming languages and the creator of the first compiler. She was a champion for increasing the usability of computers, understanding that their power and reach would be limited unless they were made to be more user friendly.
Grace Hopper pioneered the implementation of standards for computer systems 1959 – Short Range Committee - COBOL-60 1968 – American National Standards Institute – ANSI COBOL-68 1974 – ANSI COBOL-74 1985 – ANSI COBOL-85 1997 – ISO (Committee Draft) Draft – Object Oriented Cobol 2002 – ISO COBOL-2002 (OOC)
From Fr the th IS e O O 20 2 0 0 2 0 Cobol st s a t nd n ar a d r
Cobol program - A simple program Program Entry point Procedure compute a = b + c a b c Variables One program entry point One common memory
Cobol program – Multi-procedural Program Entry point 1 Procedure 1 Procedure n Entry point n compute a = b + c compute d = e + f a b c d e f Variables p1 Variables pn One program entry point One common memory for all procedures
The analogy in Object Oriented Cobol Program Entry point 1 Procedure 1 Procedure n Entry point n compute a = b + c compute d = e + f a b c d e f Variables p1 Variables pn Each procedure has its own entry point Each procedure has its own memory Each procedure is invoked individually
The OO-Cobol Class Class Entry point 1 Method 1 Method n Entry point n compute a = b + c compute d = e + f a b c d e f Variables p1 Variables pn In Object Oriented Cobol, as in Java – o a procedure is called “method” o methods are defined in a “Class”
OO-Cobol – Class Write the Cobol source that defines the Class Class Method compute a = b + c Method Variables a b c
OO-Cobol – Program invokes Class Write the Cobol source of the Program that will use the Class Class Method Program compute a = b + c invoke method… Method Variables a b c Declare a reference to the Class in the program The program can then invoke methods of the Class
OO-Cobol – Program invokes Class For example Class Method Program “Employee” “COMPUTE_SALARY” EMP_CALC Method Variables invoke method compute a = b + c NAME COMPUTE_SALARY ID DAILY_SALARY a b c
OO-Cobol – Defining a Class Class Definition Class Variables
OO-Cobol – Class Methods Method – “new” Just like a cookie cutter is used to create cookies, the Class serves as a template for creating a live instance of itself – an object. The “new” method creates the object that will be used by the program.
OO-Cobol – Class Methods Method – “new” The “new” method giving us access to an object is similar to turning the ignition key in a car – once we do so, we can use the functions that the car has to offer: driving, braking, honking and so on.
OO-Cobol – Examples of other Class Methods Method – Set Method - Compute
OO-Cobol – Referencing the Class Declaring the Class in the invoking program is analogous to declaring a file in the INPUT-OUTPUT section
OO-Cobol – Defining the object Defining the object to be used in the invoking program is analogous to defining the file record in the FILE section
OO-Cobol – Example of invoking the “new” method
OO-Cobol – Example of invoking the “GET_NAME” method
OO-Cobol – Objects Like putting a “new” coin in a slot machine “returns” a new ball to play with each time, the program can work with a number of objects at the same time.
OO-Cobol – OO implementation Encapsulation Restricting access to an Object’s components For example – Using method variables instead of global WORKING-STORAGE Inheritance Creating a sub-type of a Class while reusing its code and memory definition Example – Defining a Class for computing salaries for Employees and Managers Polymorphism Invoking the same method name in different objects, different parameters Example – “CALCULATE_SALARY” for both Manager and Employee
OO-Cobol - Inheritance Class Definition - Inherits Class Variables
OO-Cobol – Java integration Using Java Class String in an OO-Cobol program
OO-Cobol – Java integration Using JSON object
OO-Cobol – Java integration Send/Receive JSON data via Ajax with AngularJS client Run as servlet under webserver using HTTP session Use hashmaps to store data Define and use Java variable types such as String (PIC X ANY LENGTH) Define and use Java arrays (OCCURS DYNAMIC) Monitor performance using standard Java performance tools These are just a few of the possibilities that open up for you when you by using Object Oriented Cobol – getting the best of both worlds
Thank you. And one final word about Grace Hopper…
While she was working on a Mark II Computer at Harvard University in 1947, her associates discovered a moth stuck in a relay and thereby impeding operation, whereupon she remarked that they were "debugging" the system. The remains of the moth can be found in the group's log book at the Smithsonian Institution's National Museum of American History in Washington, D.C.