PowerBuilder Foundation Class: A Service Orientated Framework - PowerPoint PPT Presentation

1 / 44
About This Presentation
Title:

PowerBuilder Foundation Class: A Service Orientated Framework

Description:

Functionality is encapsulated in service classes ... Enable the requestor to customise the service. Protected instance variables ... – PowerPoint PPT presentation

Number of Views:149
Avg rating:3.0/5.0
Slides: 45
Provided by: Harg151
Category:

less

Transcript and Presenter's Notes

Title: PowerBuilder Foundation Class: A Service Orientated Framework


1
PowerBuilder Foundation ClassA Service
Orientated Framework
  • Sea Bass Software Limited
  • www.seabass.co.uk

2
Introduction
  • David Hargreaves
  • david.hargreaves_at_seabass.co.uk
  • Sea Bass Software Limited
  • www.seabass.co.uk

3
Topics for Discussion
  • PFC Architecture
  • Using PFC Services
  • Adding Additional Services

4
PFC Architecture
  • Evolution of Frameworks
  • Service Orientated Framework

5
Evolution of Frameworks
  • General Purpose Framework
  • Nest Generalisation Framework
  • Service Orientated Framework

6
General Purpose Framework
  • All functionality in one ancestor
  • Turn functionality on using functions
  • Functionality provided through instance variables

7
General Purpose Framework
Ancestor Window
boolean ib_sort FALSE boolean ib_filter FALSE
...
of_SetSort(TRUE) of_SetFilter(TRUE) ...
IF ib_sort THEN Sort code END IF IF ib_filter
THEN Filter code END IF
8
Nested Generalisation Framework
  • Ancestor class contains generic functionality
  • Descendent classes add specific functionality
  • Functionality enabled by selecting required
    descendant

9
Nested Generalisation Framework
10
Service Orientated Framework
  • Functionality is encapsulated in service classes
  • Requestor classes delegate work to service
    classes
  • Uses the Client/Server model

11
Service Orientated Framework
Services
Requestor
Base
Sort
Filter
12
PFC Architecture Summary
  • Code is encapsulated in service classes
  • Requestor calls services when required
  • Smaller hierarchy
  • Maintenance is easier
  • Quicker compilation time
  • No duplication of code
  • High level of reuse

13
Using PFC Services
  • Service Classes
  • Requestor Classes
  • Creating Services
  • Delegating Work to Services

14
Service Classes
  • Perform work specific to the service
  • Maintains a link to the requestor object

15
Service Classes
n_cst_dwsrv_sort
u_dw idw_requestor ...
of_SetRequestor(u_dw adw_requestor) idw_requestor
adw_requestor ...
pfc_clicked(xpos, ypos, row, dwo) This.of_Sort()
...
of_Sort() idw_requestor.Sort() ...
16
Requestor Classes
  • Owns service objects
  • Create service objects required
  • Maintains a link to the service object
  • Delegates work to the service object
  • Destroys the service object

17
Requestor Classes
u_dw
n_cst_dwsrv_sort inv_sort ...
of_SetSort(boolean ab_switch) inv_sort Create
n_cst_dwsrv_sort inv_sort.of_SetRequestor(This)
...
clicked(xpos, ypos, row, dwo) IF IsValid
(inv_Sort) THEN inv_Sort.Event pfc_clicked
( xpos, ypos, row, dwo ) END IF ...
18
Creating Services
  • Requestor object owns the service object
  • Requestor object creates the service (two way
    link)
  • Requestor contains pre-defined instance variables
    to point to service
  • Pre-defined requestor functions allowing the
    service to be created

19
Creating Services
u_dw (requestor)
n_cst_dwsrv_sort inv_sort
... of_SetSort(TRUE) inv_sort Create
n_cst_dwsvr_sort inv_sort.of_SetRequestor(This)
...
n_cst_dwsvr_sort (service)
u_dw idw_requestor
... idw_requestor adw_requestor ...
20
Demonstration
  • Create the default sort service
  • Create the default filter service

21
Delegating Work to Services
  • Work is delegated using pre-defined methods in
    Requestor and Service objects
  • Delegation Types
  • Pre-defined delegation
  • User-defined delegation

22
Pre-defined Delegation
  • Requestor Pre-coded events
  • PowerBuilder events
  • PFC events called from menu
  • Service Pre-coded events
  • Re-directed from requestor

23
Pre-defined Delegation
u_dw (requestor)
n_cst_dwsrv_sort inv_sort
IF IsValid (inv_Sort) THEN inv_Sort.Event
pfc_clicked ( xpos, ypos, row, dwo ) END IF
n_cst_dwsvr_sort (service)
u_dw idw_requestor
... idw_Requestor.Sort() ...
24
User-defined Delegation
  • Service pre-coded functions
  • Requestor delegates work to service
  • Used to change the state of a service

25
User-defined Delegation
u_dw (requestor)
n_cst_dwsrv_sort inv_sort
This.of_SetSort(TRUE) IF IsValid(inv_Sort)
THEN inv_Sort.of_SetStyle(inv_sort.dragdrop) END
IF
n_cst_dwsvr_sort (service)
integer ii_style
... ii_style ai_style ... Return 1
26
Demonstration
  • Assign the DRAGDROP style to the sort service
  • Assign the EXTENDED style to the filter service
  • Create the calendar service on the joining date
  • Create the calculator service on the salary

27
Using PFC Services Summary
  • Service Classes encapsulate functionality
  • Requestor Classes call required services
  • Pre-defined delegation has been coded into the
    PFC
  • User-defined delegation changes the default style
    of the service

28
Adding Additional Services
  • Create Additional Service Objects
  • Create Service Object
  • Instance variables
  • Functions
  • Events
  • Add New Service to Requestor
  • Instance variable
  • Create/Destroy function
  • Re-direct calls to service

29
Create Additional Service Objects
pfc_w_master
pfc_n_base
w_master
n_base
pfc_w_response
pfc_n_cst_dwsrv
w_response
n_cst_dwsrv
w_column_dragdrop
n_cst_dwsrv_column
30
Demonstration
  • Create a DataWindow service to allow columns to
    be moved during runtime
  • Create a column service object
  • Create a column service attribute object
  • Create a column drag and drop window

31
Create Service Functions
  • Encapsulate functionality
  • Protected instance variables
  • Protected functions
  • Enable the requestor to customise the service
  • Protected instance variables
  • Public functions to change variables

32
Create Service Functions
n_cst_dwsrv_column (Extension Layer)
string is_excludecolumns
Public of_setexclude (string as_excludecols) of
_getexclude (ref string as_excludecols) Protect
ed of_buildcolumnattrib ( ref
n_cst_columnattrib anv_columnattrib) ...
33
Demonstration
  • Create the column service functionality
  • Create the required instance variables
  • Create the public interface, such as get/set
    functions
  • Create the column functionality

34
Create Service Events
  • Create user events for requestor redirection
  • Process service functionality
  • Call additional service objects
  • Ensure a return code is provided

35
Create Service Events
n_cst_dwsrv_column (Extension Layer)
event pfc_column()
... IF NOT IsValid(idw_requestor) THEN li_rc
-1 ELSE li_rc This.of_SetColumn() END
IF RETURN li_rc
36
Demonstration
  • Create the column service events
  • Create a pfc_columndlg event to call the
    drag-drop window

37
Add New Service to Requestor
  • Add instance variable for service
  • Add of_Set() function to enable service
  • Re-direct events to service

38
Add New Service to Requestor
u_dw (Extension Layer)
n_cst_dwsrv_column inv_column ...
Public of_setcolumn(boolean ab_switch)
pfc_columndlg event IF IsValid(inv_column)
THEN inv_column.Event pfc_columndlg() END IF ...
39
Demonstration
  • Create the requestor service calls
  • Create service instance variable
  • Create function to turn service on/off
  • Create a pfc_columndlg event to call the column
    service

40
Creating Services
  • Requestor object owns the service object
  • Requestor object creates the service (two way
    link)
  • Requestor contains pre-defined instance variables
    to point to service
  • Pre-defined requestor functions allowing the
    service to be created

41
Creating Services
u_dw (requestor)
n_cst_dwsrv_column inv_column
... of_SetColumn(TRUE) inv_column Create
n_cst_dwsvr_column inv_column.of_SetRequestor(Thi
s) ...
n_cst_dwsvr_column (service)
u_dw idw_requestor
... idw_requestor adw_requestor ...
42
Demonstration
  • Create the column service to allow columns to be
    moved during runtime
  • Add a button to call the service

43
Adding Additional Services Summary
  • Create new service objects
  • Create events for redirection and functions to
    encapsulate functionality
  • Create requestor links to service object
  • Instance variable
  • Create/Destroy function
  • Re-direct functionality

44
Questions and Answers
  • David Hargreaves
  • david.hargreaves_at_seabass.co.uk
  • Sarah Bell - Business Manager
  • sarah.bell_at_seabass.co.uk
  • (01491) 682585
  • Web Site
  • www.seabass.co.uk
Write a Comment
User Comments (0)
About PowerShow.com