You are on page 1of 46

FastTrack to PowerBuilder

Appendix B:
Application Modeling
with the PowerDesigner
Plug-in

Copyright 2005 Sybase, Inc. All rights reserved.


No part of this publication may be reproduced, transmitted, or translated in any form or by any means,
electronic, mechanical, manual, optical or otherwise, without prior written permission from Sybase, Inc.
Module Pre-Assessment
1.List the three partitions in a well
architected application.
2.What PowerBuilder construct is the proper
container for business logic? Why?
3.List three benefits of a well-partitioned
application.

B-2
Module Objectives
■ At the end of this module, you should be
able to:
● Define Object Modeling for application design
● Describe the Object Modeling capabilities of

the PowerDesigner Plug-In


● Reverse engineer PowerBuilder applications

into PowerDesigner Class Diagrams


● Use Object Modeling to enhance your

PowerBuilder Code
● Generate PowerBuilder Classes from a

PowerDesigner Diagram

B-3
Object Modeling Defined
MODULE MAP PowerDesigner Integration in PowerBuilder 10

Reverse Engineering from PB into PowerDesigner

Modifying the Model

Generating PowerBuilder Objects from PowerDesign

B-4
Object Oriented Model
■ Defined
A conceptual view of a software system
expressed using Unified Modeling Language
(UML) diagrams
■ PowerDesigner plug-in shows you a graphical

view of the model


● You can zoom
the display of
large models to
focus on specific
objects, areas
or symbol types

B-5
OOM Diagram Types
Plug-In
Use Case Defines the basic structure of your appsuppor
**Class** Defines the static structure of the model t
Object Describes the structure of model elements
Collaboration Focuses on objects in action by displaying a
network of collaborating objects
Sequence Draws objects and shows a time-ordered series of
sequenced method invocations between them
Statechart Describes public behavior of a unique classifier
(use case, component or class)
Activity Models the dynamic aspects of a system
Component Shows dependencies among software components,
including source code, binary code, and
executables
Deployment Compliments component diagrams by giving more
accurate details about the physical implementation
B-6 and interaction of components
Why Create PowerDesigner Class
Often PowerBuilderDiagram?
■ developers inherit responsibility for
a legacy system they didn’t develop
■ A Class diagram can help you in:
● Design & Analysis

See a graphical display of the relationship between objects
● Redesign & Maintenance

Improve existing code and regenerate into PowerBuilder
● Documentation

Understand how the application was developed
■ Rapid Application Development
● You can rapidly create the Class structure of an entire
application from within PowerDesigner and generate
PowerBuilder code to implement the details

B-7
Object Modeling Defined
MODULE MAP PowerDesigner Integration in PowerBuilder 10

Reverse Engineering from PB into PowerDesigner

Modifying the Model

Generating PowerBuilder Objects from PowerDesign

B-8
PowerDesigner Plug-In
■ PowerBuilder 10 includes a plug-in that
provides integrated class diagram
functionality of the PowerDesigner OOM
directly inside the
PowerBuilder design
environment
■ Requires separate

license and
installation of
PowerDesigner 10

B-9
PowerDesigner Plug-in
■ Capabilities
Provides class diagram functionality of the
PowerDesigner OOM directly inside the PowerBuilder
IDE
● When enabled you can:

Link a PB target with a UML class diagram via reverse
engineering

Modify the model and generate the changes back to PB
Libraries

Initiate a new model and generate a new PB target and
objects
■ Optional automatic one-way synchronization between
a class diagram and objects in the PowerBuilder target
that it represents
● Changes in PB can be automatically applied to the
model
B - 10
PowerDesigner Plug-In
■ Options can be Options
changed once a model is
opened
■ You can configure

● Automatic one-way
sync between a target
& its model
● Automatic model

reload on workspace
open

B - 11
Repository and Online Help
■ Once the Plug-in isAccess
enabled, you can connect to
the PowerDesigner Repository
● Repository is a tool for storing versioned documents

It helps you manage development in a multi user
environment

Right-click on a model in the tree view of the Local
tab and select menu items for Repository operations,
such as Consolidate, Update from Repository, or
Compare with Repository
■ Once a class diagram painter is opened, the
Repository menu is added to the main
PowerBuilder menu
■ If PowerDesigner 10 online help is installed, then it

is also available to the Plug-in


B - 12
PowerDesigner View in
PowerBuilder

Model
View

Browse
r

Output Resul
t List

B - 13
Menu Items Available in the
■ Plug-in
These merged View
Plug-in Menus add access to
many PowerDesigner facilities:
● File
● Edit

● View

● Model

● Symbol

● Language

● Repository

● Tools

B - 14
Plug-in Toolbars
■These PowerDesigner tool bars are added to
PBthe PB menu:
PD
Toolbar Toolbar
PainterBar Standard
1
PainterBar Diagram
2
PainterBar Palette
3
PainterBar PowerBuild
4 er
PowerBar2View

B - 15
PowerBar3Respository
PowerDesigner Context Menu
■ Items
These context menu items are added in the
PB workspace view:
● Target menu

Reverse Engineer

Open Class Diagram

Plug-In Properties
● Library Menu

Open Class Diagram
● Object Menu

Find in Class Diagram

B - 16
Continued
PowerDesigner Context Menu
Items
Librar
y

Objec
t

B - 17
Object Modeling Defined
MODULE MAP PowerDesigner Integration in PowerBuilder 10

Reverse Engineering from PB into PowerDesigner

Modifying the Model

Generating PowerBuilder Objects from PowerDesign

B - 18
Reverse Engineer a
PowerBuilder Reverse
■Target
engineering is
the process of
non-invasively
parsing source
code and
building or
updating an OOM
class diagram
Target
Menu

B - 19
Continued
Reverse Engineer a

PowerBuilder
When objects Target
in a PowerBuilder target are reverse
engineered for the first time:
● The target is linked with a generated class diagram and
OOM file. By default, the generated OOM file name has the
same name as the target file, with an .oom extension
● The diagram is added to the current PD workspace
● PB Libraries are represented in the model as Packages
■ For subsequent reverse engineering you have these
choices:
● Merge with existing OOM
(default)
● Replace existing OOM
● Replace Selected packages
& classes
● Replace Selected classes

B - 20
Continued
Reverse Engineer a
PowerBuilder Target
Select:

● An entire target
● Entire libraries or

● Individual classes

in a library
■ The objects you
select are
abstracted as
classes in a UML
class diagram

B - 21
Full Mapping of PB onto OOM
Objects
Full featured mapping

● Both methods and properties are mapped


onto UML members and stereotypes
● Applies to these PowerBuilder Objects


Application

Structure

Function

User Object

Proxy

Window

B - 22
Application Object Mapping
Designated by a class
having the
<<application>>
PB Property stereotype
UML Type

Instance Attribute
Variable
Shared Static Attribute
Variable
Global Attribute with <<global>>
Variable stereotype
Property Attribute with <<property>>
stereotype
External Operation with <<external>>
Function stereotype
Function Operation
B - 23
Event Operation with
Window Object Mapping
Designated by a class having the <<window>> stereotype
PB UML Type
Property
Instance Attribute
Var
Shared Var Static Attribute

Control Inner Class with <<control>>


stereotype
Property Attribute with <<property>>
stereotype
External Operation with <<external>>
Func stereotype
Function Operation
Event Operation with
<<event>>stereotype OR
Operation with non-null event
B - 24
name
User Object Mapping
Designated by a class
having the
<<userObject>>
PB Property UMLstereotype
Type

Instance Attribute
Variable
Shared Static Attribute
Variable
Control Inner Class with <<control>>
stereotype
Property Attribute with <<property>>
stereotype
External Operation with <<external>>
Function stereotype
Function Operation
B - 25
Other Full Mappings
■ Structure
● Designated as a class with the <<structure>>
prototype
● Variables are not designed as class attributes in global
function reverse engineering
■ Global Function
● Designated as a class with the <<function>> prototype
● Class should only contain one operation
● Variables are designed as class attributes
■ Proxy
● Designated as a class with the <<proxyObject>>
prototype
● Instance variables are designed as class attributes
● Proxy functions are designated with operations

B - 26
Minimal Mapping of PB onto
■ OOM Objects
Minimal Mapping
● Maps onto PowerBuilder stereotype
● Properties not mapped onto PD class

properties
● Symbol is a large PB icon

■ Applies to these PowerBuilder objects:


● Query
● DataWindow Object

● Menu

● Project

● Pipeline

B - 27
Synchronizing to the Model
■ Once the model is built you can choose to
automatically synchronize changes to objects in
PB with the model
● Synchronization occurs during the object save to
the PBL
■ Changes to the model
are not automatically
reflected in objects in
the PBL
■ The library operations

Move, Copy & Import


do not cause
synchronization
B - 28
Object Modeling Defined
MODULE MAP PowerDesigner Integration in PowerBuilder 10

Reverse Engineering from PB into PowerDesigner

Modifying the Model

Generating PowerBuilder Objects from PowerDesign

B - 29
Opening the Diagram
■ There are two diagrams:
■ The Class diagram

■ The Package (PBL) Diagram

calc

B - 30
Class Property Sheets
■ Each class has a series of property sheets
that progressively expose access to creating
and editing members
● Access the property sheet by either:

Double clicking the class in the object
browser

Right click on the diagram and choose
■ Attributes
■ Operations
■ Associations
■ Properties

B - 31
Modifying Class Properties
■ Major PB-centric
Tabs are
● General
● Attributes

● Operations

● Inner Classifiers

● Preview

B - 32
General Properties
■ Class names can be changed:
● Name is a PD identifier
● Code is the name given when
generating PB code
■ Stereotypes (PB object
mapping) can be changed:
● Valid stereotypes are listed in
the dropdown
● Both Full & Minimal mapping
objects are listed
■ Select Generate option is for
inclusion in a Generate PB
operation

B - 33
Properties of Attributes

■ System class properties with their painter or default settings


■ Instance Variables
● Set scope, data type & initial value

■ Shared Variables
● Uncheck “D” (dynamic) to make them static

B - 34
Operation Properties
Properti
es

■ Declares both object functions and events


● Enter their Name & Code

■ For Events
● Only those containing PowerScript are listed

● To code for a new mapped event


Choose the event name from the Event edit dropdown

Leave visibility public
■ For Functions
● Declare the Return Type

■ To implement the method, select it & click the Properties Icon


B - 35
Continued
Operation Properties
■ Declare or alter
method parameters,
their type and their
pass by method
● In/Out is pass by
reference
● In is pass by value
■ Write the code for the
method implementation
● To Extend an ancestor event script, leave in the call
super:: code
● To Override it, remove the line of code
● Enter your code directly into this editor
● Compiler syntax checking occurs on object generation

B - 36
Inner Classifiers
■ For a visual class,
defines its controls
■ To alter the control

properties and event


scripts select the
control and click the
Properties icon

■ Code the event on the


Implementation tab

B - 37
Previewing Generated Source
Viewable on the
■ Code
Preview Tab of the
class Property Sheet
■ This is the source

code that will be


emitted and
imported into PB
■ Any changes you

make here are lost


when code is
generated

B - 38
Object Modeling Defined
MODULE MAP PowerDesigner Integration in PowerBuilder 10

Reverse Engineering from PB into PowerDesigner

Modifying the Model

Generating PowerBuilder Objects from PowerDesign

B - 39
Generating PB Objects from
■ the
Objects with Full Model
Featured mapping are
properly generated
■ Caution Objects with minimal mapping lose

all their attributes and operations that you


assigned in PowerDesigner
■ On the menu choose Language  Generate

PowerBuilder

B - 40
Generation Options
■ To apply OOM changes:
● Replace objects (default)
● Replace PBLs & objects

● Replace entire target

■ Check Model
● Reports errors for:

Illegal class names

More than 1 App object

More than 1 operation in a function class

Structures with operations

Controls can only be inner classes

B - 41
Labs
■ Lab B-1: Working with the PowerDesigner
Plug-in

B - 42
Lab Debriefing
■ What did you do and why?
■ What went well in the lab?

■ What insights did you get during the lab?

■ What did you observe in the lab?

■ What did you find challenging?

■ Add any items to your troubleshooting list

B - 43
Module Summary
■ An OOM is:
● A structure that provides a close description
of a system using the Unified Modeling
Language (UML) diagrams
■ With the PowerDesigner Plug-in, you can:
● Build an OOM following UML diagram
notation
● Reverse engineer PowerBuilder objects

● Alter the Model

● Generate PowerBuilder Objects

B - 44
Module Post-Assessment
1.List 2 PowerBuilder objects that have
minimal mapping into UML.
2.What happens in PowerDesigner to User
Object Class inheritance relationships when
reverse engineering a PowerBuilder
application (e.g. Window)?

B - 45
B - 46

You might also like