object-oriented programming and the progress abl tomáš kučera principal solution engineer / emea...
TRANSCRIPT
Object-Oriented Programming and the Progress ABL
Tomáš KučeraPrincipal Solution Engineer / EMEA Power Team
© 2007 Progress Software Corporation2
> whoami
Started with Progress Software Czech Republic – Dec 19, 1994
2 years @ Technical Support (1996 at ETSC) Since Dec 1996 – Consultant, Presales, Trainer,
Project Manager Currently – GFS Mgmt responsibilities for Cze&Pol,
Member of the EMEA Power Team – primary responsibility for SAND
Product Areas: OpenEdge, Sonic, some Apama and Actional
Contact: [email protected], Skype: tomas_kucera
TKU
© 2007 Progress Software Corporation3
Agenda
Obligatory Theory Simple Sample
© 2007 Progress Software Corporation4
What are Objects?
You interact with objects everyday• A customer• An order
All objects contains state and behavior• What they can do and what changes when they do
Software objects represent these as:• Data ( like 4GL variables )• Methods ( like 4GL procedures)
• Your car
• The telephone
© 2007 Progress Software Corporation5
Object-Oriented Principles
Abstraction• Break up complex problem• Focus on public view, commonalities
Encapsulation • Hide implementation details• Package data and methods together
Hierarchies• Build new objects by referencing or
extending other objects
© 2007 Progress Software Corporation6
Type• Enforces type consistency at compile time
Class• Defines type with data and methods and
provides implementation
Object• Runtime instantiation of class
Interface• Defines type with only methods – no
implementation provided
Object-Oriented Constructs
© 2007 Progress Software Corporation7
Why should I care about Object-Orientation?
Object-orientation is a highly structured way to build applications• Simpler modeling tool integration, e.g.
roundtrip engineering
Code benefits• Less bugs
• More reuse
Business benefits• Time to market
• Better maintainability
Object-orientation’s big benefits
© 2007 Progress Software Corporation8
Why should I care about Object-Orientation?
Strong Typing• Less runtime processing
• Improved quality through finding errors at compile-time
• Class hierarchy known at compile-time
Re-use• Abstraction means code re-use
• Classes can be deployed for re-use
• Improved quality and higher productivity
How do we get the benefits?
© 2007 Progress Software Corporation9
Requires more forethought than procedural• Type hierarchies can be hard to change
– Refactoring and modeling can help
Requires a base class library to get started• Base classes can take a while to build
Different mindset from procedural• Easier, if you have worked with super
procedures before
Unfortunately it is not totally free
© 2007 Progress Software Corporation10
Object-Orientation versus Procedural
“Types” are created at run-time
Type definition is loosely bound
Inheritance is determined at run-time
Provides flexibility for generic code
Types are known at compile time
Type definition is contractual
Inheritance is set at design-time
Prevents run-time type errors
Procedural OO
© 2007 Progress Software Corporation11
Mapping Procedures to Classes
Procedure Files (.p) Main block code Internal Procedures Functions ON CLOSE Super procedures
Class Files (.cls) Constructor Void Methods Method Destructor Inheritance
Procedure Class
© 2007 Progress Software Corporation12
Agenda
Obligatory Theory Simple Sample
© 2007 Progress Software Corporation13
Simple Sample
Create a solution using Progress OOABL that will perform the following:• Feature #1- it will retrieve data from a specific
database table into a temp-table based on provided WHERE phrase and will provide access to it
• Feature #2 - it will check access privileges to the table
• Feature #3 - it will display the data
The Scenario
© 2007 Progress Software Corporation14
Simple Sample
Standard Progress ABL Sophisticated Progress ABL with includes,
persistent procedures, super procedures Progress OOABL
Quiz: The Approach
© 2007 Progress Software Corporation15
Simple Sample
Standard Progress ABL Sophisticated Progress ABL with includes,
persistent procedures, super procedures Progress OOABL
Answer: The Approach
© 2007 Progress Software Corporation16
Simple Sample
Encapsulation Inheritance Typing Interfaces Polymorphism Delegation
What we will see and will not see
Encapsulation Inheritance Typing Interfaces Polymorphism Delegation
© 2007 Progress Software Corporation17
Simple Sample
The Modelclass SimpleSample
«BusinessEntity»BusinessEntity
+ h_entity: HANDLE+ h_query: HANDLE
+ Constructor() : void+ Destructor() : void+ RetrieveData(CHARACTER) : void- CheckAccess() : LOGICAL
«BusinessEntity»BECustomer
+ h_custnum: HANDLE+ h_name: HANDLE
+ Constructor() : void+ Destructor() : void+ RetrieveData(CHARACTER) : void
«inherits»
© 2007 Progress Software Corporation18
Simple Sample
Let‘s do it!
© 2007 Progress Software Corporation20
Where to get more
Information resources
OpenEdge Documentation:• Getting Started: 10.1B Object-oriented
Programming manual PSDN - www.psdn.com
• Library – Products – OpenEdge – Development Tools & Language – Advanced Business Language (ABL)
• Library – Product Documentation – OpenEdge Release 10.1B Product Documentation – Getting Started
© 2007 Progress Software Corporation21