Object-Oriented Programming and the Progress ABL

handprintΛογισμικό & κατασκευή λογ/κού

18 Νοε 2013 (πριν από 3 χρόνια και 10 μήνες)

97 εμφανίσεις

Object
-
Oriented Programming and the
Progress ABL

Tomáš Kučera

Principal Solution Engineer / EMEA Power Team

© 2007 Progress Software Corporation

2

> 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: tku@progress.com, Skype: tomas_kucera

TKU

© 2007 Progress Software Corporation

3

Agenda


Obligatory Theory


Simple Sample

© 2007 Progress Software Corporation

4

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 Corporation

5

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 Corporation

6


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 Corporation

7

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 Corporation

8

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 Corporation

9


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 Corporation

10

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 Corporation

11

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 Corporation

12

Agenda


Obligatory Theory


Simple Sample

© 2007 Progress Software Corporation

13

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 Corporation

14

Simple Sample


Standard Progress ABL


Sophisticated Progress ABL with includes,
persistent procedures, super procedures


Progress OOABL

Quiz: The Approach

© 2007 Progress Software Corporation

15

Simple Sample


Standard Progress ABL


Sophisticated Progress ABL with includes,
persistent procedures, super procedures


Progress OOABL

Answer: The Approach

© 2007 Progress Software Corporation

16

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 Corporation

17

Simple Sample

The Model

class SimpleSample
«Busi nessEnti ty»
BusinessEntity
+
h_enti ty: HANDLE
+
h_query: HANDLE
+
Constructor() : voi d
+
Destructor() : voi d
+
Retri eveData(CHARACTER) : voi d
-
CheckAccess() : LOGICAL
«Busi nessEnti ty»
BECustomer
+
h_custnum: HANDLE
+
h_name: HANDLE
+
Constructor() : voi d
+
Destructor() : voi d
+
Retri eveData(CHARACTER) : voi d
«i nheri ts»
© 2007 Progress Software Corporation

18

Simple Sample

Let‘s do it!

© 2007 Progress Software Corporation

19

Question?

Tomáš Kučera

tku@progress.com

Skype: tomas_kucera

customer

© 2007 Progress Software Corporation

20

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 Corporation

21