Peter Judge A8: What’s New in Object-Oriented ABL Principal Software Engineer OpenEdge 10.1C and beyond.

Slides:



Advertisements
Similar presentations
Improving your OpenEdge® Development Productivity David Lund Sr. Training Program Manager, Progress.
Advertisements

REST support for B2B access to your AppServer PUG Challenge Americas Michael Jacobs : Senior Software Architect Edsel Garcia : Principal Software.
OpenEdge® Object-oriented ABL
Chapter 1 OO using C++. Abstract Data Types Before we begin we should know how to accomplish the goal of the program We should know all the input and.
A5: Structured Error Handling in the ABL Phillip Malone Senior Technical Support Engineer.
DEV-13: You've Got a Problem, Here’s How to Find It
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Road Map Introduction to object oriented programming. Classes
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
16/22/2015 2:54 PM6/22/2015 2:54 PM6/22/2015 2:54 PMObject-Oriented Development Concept originated with simulating objects and their interactions. Adapted.
Terms and Rules Professor Evan Korth New York University (All rights reserved)
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
What’s new in Progress Developer Studio for OpenEdge 11.0?
Review of C++ Programming Part II Sheng-Fang Huang.
OOP Languages: Java vs C++
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
 2006 Pearson Education, Inc. All rights reserved Classes: A Deeper Look.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 13: Pointers, Classes, Virtual Functions, and Abstract Classes.
Lecture 22 Miscellaneous Topics 4 + Memory Allocation.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 14: Pointers, Classes, Virtual Functions, and Abstract Classes.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
220 FINAL TEST REVIEW SESSION Omar Abdelwahab. INHERITANCE AND POLYMORPHISM Suppose you have a class FunClass with public methods show, tell, and smile.
© 2009 Progress Software Corporation 1 Click to Edit Master Subtitle Style Overview of OpenEdge® GUI for.NET Release 10.2A Jarmo Nieminen Senior Technical.
CSM-Java Programming-I Spring,2005 Objects and Classes Overview Lesson - 1.
Object-oriented programming in the Progress® 4GL 10.1A Beta
DEV-12: Object-oriented Programming in OpenEdge® ABL
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Object-Oriented Programming and the Progress ABL Tomáš Kučera Principal Solution Engineer / EMEA Power Team.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Object Oriented Programming with C++/ Session 6 / 1 of 44 Multiple Inheritance and Polymorphism Session 6.
Programming Languages and Paradigms Object-Oriented Programming.
Tuc Goodwin  Object and Component-Oriented Programming  Classes in C#  Scope and Accessibility  Methods and Properties  Nested.
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
Catch Me If You Can P ractical Structured Error Handling Peter van Dam.
Programming in Java CSCI-2220 Object Oriented Programming.
Object Oriented Software Development
AN OBJECT LESSON IN CLASSES “or how OO ABL solves everything.”
Introduction to Design Patterns. Questions What is a design pattern? Who needs design patterns? How different are classes and objects in APL compared.
ARCH-7: A Class-Based Implementation of the OpenEdge® Reference Architecture John Sadd Fellow and OpenEdge Evangelist Applied Technology.
ARCH-11: Building your Presentation with Classes John Sadd Fellow and OpenEdge Evangelist Sasha Kraljevic Principal TSE.
SONIC-3: Creating Large Scale Installations & Deployments Andrew S. Neumann Principal Engineer Progress Sonic.
DEV-6: Advanced Object-Oriented Programming in the ABL Evan Bleicher Senior Development Manager Shelley Chase
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 26 - Java Object-Based Programming Outline 26.1Introduction.
Java Basics Opening Discussion zWhat did we talk about last class? zWhat are the basic constructs in the programming languages you are familiar.
Introduction to Java Chapter 7 - Classes & Object-oriented Programming1 Chapter 7 Classes and Object-Oriented Programming.
CS451 - Lecture 2 1 CS451 Lecture 2: Introduction to Object Orientation Yugi Lee STB #555 (816) * Acknowledgement:
Introduction to Object-Oriented Programming Lesson 2.
Principles of programming languages 10: Object oriented languages Isao Sasano Department of Information Science and Engineering.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Today: –Review declaration, implementation, simple class structure. –Add an exception class and show.
What’s New in the ABL in OpenEdge Release 11.6
STL CSSE 250 Susan Reeder. What is the STL? Standard Template Library Standard C++ Library is an extensible framework which contains components for Language.
Classes, Interfaces and Packages
CIS 200 Test 01 Review. Built-In Types Properties  Exposed “Variables” or accessible values of an object  Can have access controlled via scope modifiers.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
Chapter 10: Classes and Data Abstraction. Classes Object-oriented design (OOD): a problem solving methodology Objects: components of a solution Class:
Polymorphism and Virtual Functions One name many shapes behaviour Unit - 07.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
Object-Oriented Programming: Classes and Objects.
DEV-25: You've Got a Problem, Here’s How to Find It
DEV-12: What’s New in Object-Oriented ABL
DEV-20: Using Classes and Procedures in OpenEdge® 10.1B
DEV-4: Structured Error Handling in the ABL
MOVE-11: Using Classes and Procedures in OpenEdge® 10
DEV-08: Exploring Object-oriented Programming
Delivering great hardware solutions for Windows
Presentation transcript:

Peter Judge A8: What’s New in Object-Oriented ABL Principal Software Engineer OpenEdge 10.1C and beyond

© 2008 Progress Software Corporation 2 Agenda  Overview of Object-oriented ABL  10.1C Features Static behavior and data Dynamic programming Error handling Data widening, NEW function, reserved keywords, THIS-OBJECT  Futures

© 2008 Progress Software Corporation 3 What is Object-oriented ABL…  Functionality centered around objects Classes encapsulate data and behavior –Properties and variables –Methods, constructors and destructor Inheritance shares common behavior Interfaces publish a common API Objects are the runtime instance of a class  Strong-typing does compile time validation  Can be combined with procedures OpenEdge 10.1 Releases

© 2008 Progress Software Corporation 4 Benefits of Procedural and OO Programming  Procedures and Classes Modular programming Supports reuse of common behavior (super) Maps well to OpenEdge Reference Architecture  Classes only Programming errors caught early by compiler Natural integration with modeling tools and other Object-oriented platforms like.NET ™ Modern programming model (used at most universities) OpenEdge is committed to both programming models

© 2008 Progress Software Corporation 5 Agenda  Overview of Object-oriented ABL  10.1C Features Static behavior and data Dynamic programming Error handling Data widening, NEW function, reserved keywords, THIS-OBJECT  Futures

© 2008 Progress Software Corporation 6 Wouldn’t It Be Great If… … Static Class Members  Classes supported global variables within a session?  You could always get a reference to the same object every time you wanted to… without keeping track of anything?

© 2008 Progress Software Corporation 7 Data A Step Back: Instance Data OpenEdge Runtime MyClass Separate copy of data for each instance  Always need to NEW an object to access members  Unique data segment for each instance

© 2008 Progress Software Corporation 8 Instance Data DEF VAR myClassRef AS CLASS MyClass. myClassRef = NEW CLASS MyClass( “Joe” ). DELETE OBJECT myClassRef. myClassRef = NEW CLASS MyClass( “Tim” ). DELETE OBJECT myClassRef. myClassRef = NEW CLASS MyClass( “Ann” ). DELETE OBJECT myClassRef. CLASS MyClass: … DEFINE PUBLIC PROPERTY Count AS INT GET. SET. DEFINE PUBLIC PROPERTY Name AS CHARACTER GET. SET. CONSTRUCTOR MyClass ( inName AS CHARACTER ): Name = inName. Count = Count + 1. END CONSTRUCTOR. END CLASS. Count = 1 Name = Ann Count = 1 Name = Joe Count = 1 Name = Tim

© 2008 Progress Software Corporation 9 Static Data Classes and Static Data OpenEdge Runtime MyClass  Access to static members do not require a NEW object  One global data segment One copy of data for the session

© 2008 Progress Software Corporation 10 Static Data MyClass:Count = MyClass:Count + 1. MyClass:Name = “Joe”. MyClass:Count = MyClass:Count + 1. MyClass:Name = “Tim”. MyClass:Count = MyClass:Count + 1. MyClass:Name = “Ann”. Count = 1 Name = Joe Count = 2 Name = Tim Count = 3 Name = Ann CLASS MyClass: … DEFINE PUBLIC STATIC PROPERTY Count AS INT GET. SET. DEFINE PUBLIC STATIC PROPERTY Name AS CHARACTER GET. SET. CONSTRUCTOR MyClass ( inName AS CHARACTER ): Name = inName. Count = Count + 1. END CONSTRUCTOR END CLASS.

© 2008 Progress Software Corporation 11 Classes are not Static…  Mix of instance and static members allowed Static members accessed using class type name Instance members accessed using object reference Unqualified references allowed inside class  Static members created before instances  Static constructor runs before instances

© 2008 Progress Software Corporation 12 ABL Static Data – “Typed” Global Data  Definition of static properties and data members Useful for session-wide data –Variables, buffers, temp-tables, queries, datasets, data sources  Available anywhere in the session Single instance life-cycle controlled by the AVM Access using class type name MESSAGE MyClass:Count. DEFINE PUBLIC STATIC PROPERTY Count AS INT GET. SET.

© 2008 Progress Software Corporation 13 ABL Static Constructor  Definition of static constructor Useful to initialize static data –Only one static constructor per class –No arguments or access mode –Can access STATIC data of the class –Can RUN procedures –Can NEW classes (even this one!)  Run automatically before any class member access is allowed CONSTRUCTOR STATIC MyClass ( ): Count = 0. /* Initialize static counter */ END.

© 2008 Progress Software Corporation 14 ABL Static Methods  Definition of static methods Useful when instance data is not required –Can access STATIC data of the class –Can RUN procedures –Can NEW classes (even this one!)  Available anywhere in the session Access using class type name METHOD STATIC PUBLIC INT DisplayMessage( c AS CHAR ): MESSAGE c VIEW-AS ALERT-BOX. END. MyClass:DisplayMessage( “Statics are cool” ).

© 2008 Progress Software Corporation 15 Accessing a Static Class Member  Access static data member Count Runtime checks if static class members are loaded; it’s not so /* MyClass class not instantiated */ MESSAGE MyClass:Count VIEW-AS ALERT-BOX. MyClass

© 2008 Progress Software Corporation 16 Accessing a Static Class Member  Access static data member Count Runtime checks if static class members are loaded; it’s not so –Creates static global data segment  ttUsers and Count /* MyClass class not instantiated */ MESSAGE MyClass:Count VIEW-AS ALERT-BOX. MyClass STATIC ttUsers Count

© 2008 Progress Software Corporation 17 Accessing a Static Class Member  Access static data member Count Runtime checks if static class members are loaded; it’s not so –Creates static global data segment  ttUsers and Count –Runs static constructor  Initialize Count and ttUsers /* MyClass class not instantiated */ MESSAGE MyClass:Count VIEW-AS ALERT-BOX. MyClass STATIC ttUsers = … Count = 0 Joe, 3 Tim, 2 Ann, 5

© 2008 Progress Software Corporation 18 Accessing a Static Class Member  Access static data member Count Runtime checks if static class members are loaded; it’s not so –Creates static global data segment  ttUsers and Count –Runs static constructor  Initialize Count and ttUsers –Gets value of Count /* MyClass class not instantiated */ MESSAGE MyClass:Count VIEW-AS ALERT-BOX. MyClass STATIC ttUsers = … Count = 0

© 2008 Progress Software Corporation 19 MyClass New’ing a Class with Static Members DEFINE VAR objRef AS MyClass. objRef = NEW CLASS MyClass( “Joe” ).  NEW an instance of MyClass Runtime checks if static class members are loaded; it is. STATIC ttUsers = … Count = 0

© 2008 Progress Software Corporation 20 MyClass New’ing a Class with Static Members DEFINE VAR objRef AS MyClass. objRef = NEW CLASS MyClass( “Joe” ).  NEW an instance of MyClass Runtime checks if static class members are loaded; it is. Creates local data segment – name STATIC ttUsers = … Count = 0 Instance name

© 2008 Progress Software Corporation 21 MyClass New’ing a Class with Static Members DEFINE VAR objRef AS MyClass. objRef = NEW CLASS MyClass( “Joe” ).  NEW an instance of MyClass Runtime checks if static class members are loaded; it is. Creates local data segment – name Runs instance constructor –Sets instance data name –Increments static data Count STATIC ttUsers = … Count = 1 Instance name = Joe

© 2008 Progress Software Corporation 22 MyClass New’ing a Class with Static Members DEFINE VAR objRef AS MyClass. objRef = NEW CLASS MyClass( “Joe” ).  NEW an instance of MyClass Runtime checks if static class members are loaded; it is. Creates local data segment – name Runs instance constructor –Sets instance data name –Increments static data Count  Assigns new instance to object reference STATIC ttUsers = … Count = 1 Instance name = Joe

© 2008 Progress Software Corporation 23 MyClass New’ing a Class with Static Members DEFINE VAR objRef2 AS MyClass. objRef2 = NEW CLASS MyClass( “Tim” ). STATIC ttUsers = … Count = 2 Instance name = Joe Instance name = Tim  NEW an instance of MyClass Runtime checks if static class members are loaded; it is. Creates local data segment – name Runs instance constructor –Sets instance data name –Increments static data Count  Assigns new instance to object reference

© 2008 Progress Software Corporation 24 MyClass New’ing a Class with Static Members DEFINE VAR objRef3 AS MyClass. objRef3 = NEW CLASS MyClass( “Ann” ). STATIC ttUsers = … Count = 3 Instance name = Joe Instance name = Tim  NEW an instance of MyClass Runtime checks if static class members are loaded; it is. Creates local data segment – name Runs instance constructor –Sets instance data name –Increments static data Count  Assigns new instance to object reference Instance name = Ann

© 2008 Progress Software Corporation 25 Singleton Design Pattern  Single instance of the class  Available from anywhere within the session  Loaded on demand Singleton Class  Instance Data members Avoids any restrictions on static data  Private or protected constructor  Single instance created on demand  Used to return an object reference to a single instance of the class

© 2008 Progress Software Corporation 26 Demo – Singleton Class

© 2008 Progress Software Corporation 27 Developing with STATIC Members  Static class members loaded for the life of the session When a.cls file is changed and re-compiled, the static portion is NOT refreshed  Caution during development One active session shared by application and development environment Recompile does not reload any static changes –Runtime error for mismatches can occur Session must be restarted Static lifecycle controlled by OpenEdge Runtime

© 2008 Progress Software Corporation 28 Developing with STATIC Members  Static class members loaded for the life of the session When a.cls file is changed and re-compiled, the static portion is NOT refreshed  Caution during development One active session shared by application and development environment Recompile does not reload any static changes –Runtime error for mismatches can occur Session must be restarted Static lifecycle controlled by OpenEdge Runtime Use Architect Launch Configurations

© 2008 Progress Software Corporation 29 Wouldn’t It Be Great If…  You could create an instance of a class passing in a character expression for the class type name at runtime? … DYNAMIC-NEW and DYNAMIC-CAST

© 2008 Progress Software Corporation 30 Dynamic Programming in OO ABL  DYNAMIC-NEW New a class using a character expression and it’s constructor parameters Object reference is normally a super class  DYNAMIC-CAST Cast an object reference to a type using a character expression  Full Progress.Lang.Class reflection API still on roadmap OO Strong-typing restricts dynamic programming

© 2008 Progress Software Corporation 31 METHOD BusinessEntity CreateBE( beType AS CHAR): DEFINE VARIABLE myObj AS BusinessEntity. myObj = DYNAMIC-NEW STRING(“BE” + beType)(parm1, …). RETURN myObj. END METHOD. Dynamic Object Creation  DYNAMIC-NEW Used to create a new instance –Fully qualified character type name  USING is not used –Common parameter list Returns a strongly-typed object –Type checked at runtime BusinessEntity BEEmployee BECustomer “BE” + beType

© 2008 Progress Software Corporation 32 Dynamic Object Casting METHOD BusinessEntity CreateBE( beType AS CHAR): DEFINE VARIABLE myObj AS BusinessEntity. myObj = DYNAMIC-NEW STRING(“BE” + beType)(parm1, …). DYNAMIC-CAST( myObj,STRING(“BE” + beType). RETURN myObj. END METHOD.  DYNAMIC-CAST Used to cast an object reference –Fully qualified character type name  USING is not used Returns a strongly-typed object –Type checked at runtime “BE” + beType BusinessEntity BEEmployee BECustomer

© 2008 Progress Software Corporation 33 ClassFactory Design Pattern  Class returns different types of classes  Available from anywhere within the session  Alternative is a large CASE statement ClassFactory Class  Creates different classes Common super class for all classes Common set of constructor parameters  Type name passed in at runtime

© 2008 Progress Software Corporation 34 Demo – Class Factory

© 2008 Progress Software Corporation 35 Wouldn’t It Be Great If… … Structured Error Handling  ABL had a common way to deal with all errors (system and application)?  An error could be thrown out of the local block / procedure and handled elsewhere?

© 2008 Progress Software Corporation 36 Structured Error Handling  TRY – CATCH model Based on new built-in error objects Uses existing ABL blocks: DO, REPEAT, … System and application errors treated equally Can be used in classes and procedures Fully integrated with existing error handling –NO-ERROR –ERROR-STATUS –RETURN ERROR

© 2008 Progress Software Corporation 37 Error Object Hierarchy Progress.Lang.Object Progress.Lang.ProError Progress.Lang. AppError Progress.Lang. SysError Progress.Lang. SoapFaultError User-Defined Error Objects Progress.Lang. Error > System Errors Application Errors

© 2008 Progress Software Corporation 38 Error Handling Example: System Error  CATCH put on existing FOR EACH block… FOR EACH Customer: FIND Order /* Fails */ MESSAGE "Never reach here". CATCH err AS Progress.Lang.SysError: /* Handle error here */ MESSAGE err:GetMessage(1). END CATCH. END.

© 2008 Progress Software Corporation 39 Error Handling Example: Application Error DO ON ERROR, UNDO LEAVE: RUN doIt.p./* RETURNS AppError */ MESSAGE "Never reach here". CATCH err AS Progress.Lang.AppError: /* Handle error here */ MESSAGE err:ReturnValue. END CATCH. END.  CATCH put on existing DO block for running a procedure…

© 2008 Progress Software Corporation 40 Wouldn’t It Be Great If… CC HARACTER data could be passed for a LONGCHAR NN EW could be called as an expression RR eserved keywords could be used for class member names TT HIS-OBJECT could be used to qualify a class member

© 2008 Progress Software Corporation 41 Data Widening  More flexible parameters passing 10.1B New for 10.1C Narrower to Wider INTEGER > INT64 > DECIMAL DATE > DATETIME > DATETIME-TZ Strong-typing rules for compatibility Narrower(32K) to Wider (1GB) CHARACTER > LONGCHAR

© 2008 Progress Software Corporation 42 NEW function  NEW statement ( 10.1A ) Similar to an assignment Assigns an object reference to a variable  NEW function ( 10.1C ) Object created as part of an expression Returns a reference to new object No need to assign it to an intermediate variable

© 2008 Progress Software Corporation 43 Caution Using NEW function  Object cleanup Object not assigned to anything – memory leak! Object assigned to something –Parameter receiving object responsible for cleanup MESSAGE “Using NEW function” (NEW myObject()):myMethod( ). RUN myProc.p ( INPUT NEW myObject() ).

© 2008 Progress Software Corporation 44 Caution Using NEW function  Object cleanup Object not assigned to anything – memory leak! Object assigned to something –Parameter receiving object responsible for cleanup MESSAGE “Using NEW function” (NEW myObject()):myMethod( ). RUN myProc.p ( INPUT NEW myObject() ). Garbage Collection planned for 10.2A

© 2008 Progress Software Corporation 45 Reserved Keywords in Classes  ABL Reserved Keywords can be used for: Class names –Best to prefix with packages Method names DEFINE VAR myClass AS CLASS Form. myClass = New Form( ). myClass:Create( ). CLASS Form: CONSTRUCTOR PUBLIC Form( ): … METHOD PUBLIC INT Create( ): …

© 2008 Progress Software Corporation 46 THIS-OBJECT as a Local Qualifier  Qualifier used inside a class when accessing local method, variable, and property names Identifies member as class instance Enables content assist in Architect Required when a local method name is a reserved keyword CLASS Form: CONSTRUCTOR PUBLIC Form( ): THIS-OBJECT:Create( ). END. METHOD PUBLIC INT Create( ): …

© 2008 Progress Software Corporation 47 Agenda  Overview of Object-oriented ABL  10.1C Features Static behavior and data Dynamic programming Error handling Data widening, NEW function, reserved keywords, THIS-OBJECT  Futures

© 2008 Progress Software Corporation 48 D I S C L A I M E R Under Development  This talk includes information about potential future products and/or product enhancements.  What I am going to say reflects our current thinking, but the information contained herein is preliminary and subject to change. Any future products we ultimately deliver may be materially different from what is described here. D I S C L A I M E R

© 2008 Progress Software Corporation 49 Expected 10.2A Functionality  Properties in Interfaces Defines data portion of contract  Advanced GUI New UI Model Access to.NET UI Classes  Garbage collection Automatic cleanup  Array Enhancements Arrays of Objects Public arrays variables and properties Return value support for methods and functions Vector assignment

© 2008 Progress Software Corporation 50 A Glimpse Further into the Roadmap  Strongly-typed events Define, Publish and Subscribe in Classes  Remote objects Pass objects across an AppServer  Abstract methods Force implementation in subclasses  Inheritance for Interfaces Allow one Interface to inherit from another

© 2008 Progress Software Corporation 51 Questions ?

© 2008 Progress Software Corporation 52 Thank You

© 2008 Progress Software Corporation 53