Object-Oriented Programming and the Progress ABL Tomáš Kučera
Download
Report
Transcript Object-Oriented Programming and the Progress ABL Tomáš Kučera
Object-Oriented Programming and the
Progress ABL
Tomáš Kučera
Principal Solution Engineer / EMEA Power Team
> whoami
TKU
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
2
© 2007 Progress Software Corporation
Agenda
Obligatory Theory
Simple Sample
3
© 2007 Progress Software Corporation
What are Objects?
You interact with objects everyday
• A customer
• An order
• Your car
• The telephone
All objects contains state and behavior
• What they can do and what changes when
they do
Software objects represent these as:
• Data
• Methods
4
( like 4GL variables )
( like 4GL procedures)
© 2007 Progress Software Corporation
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
5
© 2007 Progress Software Corporation
Object-Oriented Constructs
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
6
© 2007 Progress Software Corporation
Why should I care about Object-Orientation?
Object-orientation’s big benefits
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
7
© 2007 Progress Software Corporation
Why should I care about Object-Orientation?
How do we get the benefits?
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
8
© 2007 Progress Software Corporation
Unfortunately it is not totally free
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
9
© 2007 Progress Software Corporation
Object-Orientation versus Procedural
Procedural
“Types” are created at
run-time
Type definition is
loosely bound
Inheritance is
determined at run-time
Provides flexibility for
generic code
10
OO
Types are known at
compile time
Type definition is
contractual
Inheritance is set at
design-time
Prevents run-time type
errors
© 2007 Progress Software Corporation
Mapping Procedures to Classes
Class
Procedure
11
Procedure Files (.p)
Main block code
Internal Procedures
Functions
ON CLOSE
Super procedures
Class Files (.cls)
Constructor
Void Methods
Method
Destructor
Inheritance
© 2007 Progress Software Corporation
Agenda
Obligatory Theory
Simple Sample
12
© 2007 Progress Software Corporation
Simple Sample
The Scenario
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
13
© 2007 Progress Software Corporation
Simple Sample
Quiz: The Approach
Standard Progress ABL
Sophisticated Progress ABL with includes,
persistent procedures, super procedures
Progress OOABL
14
© 2007 Progress Software Corporation
Simple Sample
Answer: The Approach
Standard Progress ABL
Sophisticated Progress ABL with includes,
persistent procedures, super procedures
Progress OOABL
15
© 2007 Progress Software Corporation
Simple Sample
What we will see and will not see
16
Encapsulation
Inheritance
Typing
Interfaces
Polymorphism
Delegation
© 2007 Progress Software Corporation
Simple Sample
The Model
class SimpleSample
«BusinessEntity»
BusinessEntity
+
+
h_entity: HANDLE
h_query: HANDLE
+
+
+
-
Constructor() : void
Destructor() : void
RetrieveData(CHARACTER) : void
CheckAccess() : LOGICAL
«inherits»
«BusinessEntity»
BECustomer
17
+
+
h_custnum: HANDLE
h_name: HANDLE
+
+
+
Constructor() : void
Destructor() : void
RetrieveData(CHARACTER) : void
© 2007 Progress Software Corporation
Simple Sample
Let‘s do it!
18
© 2007 Progress Software Corporation
Question?
customer
Tomáš Kučera
[email protected]
Skype: tomas_kucera
19
© 2007 Progress Software Corporation
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
20
© 2007 Progress Software Corporation
21
© 2007 Progress Software Corporation