PowerBuilder 10 and PowerDesigner 10 Berndt Hamböckhamboeck@pocketpb.com
Agenda • Why PowerDesigner and PowerBuilder? • The PowerDesigner Plug-In • The Class Diagram • PowerDesigner 10 and PowerBuilder 10 Together • Reverse Engineering • Changing • Forward Engineering • Demo
Problem Statement • Most of PowerBuilder developers don’t do design. • Many PowerBuilder applications don’t have a good architecture and there is no documentation. • It is difficult to maintain and evolve when the developers are gone.
Solution -> PowerDesigner • PowerDesigner is a good enterprise modeling tool • Leading Data Modeling tool • Complete UML support (9 UML diagrams) • Business Process Modeling features • Good Repository • Integration with Integration Orchestrator, Message Broker, ebXML • Design and generate code for PowerBuilder, Web Services, J2EE (EJB, O/R mapping), .NET, etc. • Support all major databases (more than 30) • Support major application servers (EAServer, WebLogic, WebSphere) • Integration with IDEs (Eclipse, JBuilder 8, Ant) • Extensibility (Profile, Code generator, VBScript, OLE automation)
PowerDesigner 10 Features • PowerDesigner 10.0 supports tight integration with PowerBuilder 10 • PowerBuilder 10 is able to embed PowerDesigner views inside PowerBuilder • PowerBuilder is able to control PowerDesigner • PowerDesigner generates complete PowerBuilder application code (post 10.0)
PowerDesigner Value Proposition • Help users to understand how the application was developed. • Help users to visually see the relationship between objects. • Help users to improve existing code, refactor the code. • Regenerate PowerBuilder application. • Generate documentation (report) in HTML and RTF format.
The PowerDesigner plug-in • Integrated into PowerBuilder • Enable/Disable • Adapted for PowerBuilder users • Easy to reverse engineer, design and generate PowerBuilder objects or applications • Removes features that are not relevant for PowerBuilder users • Needs PowerDesigner 10 installed
Plug-in Manager • PowerDesigner Workspace, Result List & Output windowwill be displayed within the PowerBuilder 10 IDE • PowerDesigner Toolbars will be added • PowerDesigner plug-in menu items will be added to • the PowerBuilder target • Library and Object context menu in System tree
Representing PowerBuilder Objects in Class Diagram • A PowerBuilder target is represented by an Object Oriented Model • An OOM consists of Packages and Reports • An OOM has a default Class Diagram - Top Level Class Diagram • An OOM has an Extended Attribute “Target Path” - the file name of a linked PowerBuilder target • A PowerBuilder target has a plug-in attribute “oompath” - the file name of a linked OOM
Displaying PowerBuilder Objects in Class Diagram • A class diagram shows • packages, inheritances, associations, dependencies, attributes, operations. • Library: • Each is represented by a package. • A stereotype and a mini icon • show the type of object. • Dependencies: • Show which menu or data window is used by which window.
Displaying PowerBuilder Objects in Class Diagram • Classes: • Window, user object, application, structure, function and proxy are represented as classes and the code is regenerated from the class definition. • Other objects (datawindows, menus, query, pipeline) are represented as classes, the source code is kept and are not regenerated from the class definition. • Controls: • are represented by inner classes.
Displaying PowerBuilder Objects in Class Diagram library Package Other Class Window user object Application Structure Function proxy Class Dependencies /Generation Inner Class
Reverse Engineering for PowerBuilder Reverse Engineer From PowerBuilder • Select “Reverse Engineer” From PowerBuilder Target Context Menu • Select PBLs and Objects to Reverse Engineer
Reverse Engineering for PowerBuilder • Reverse Engineering a PowerBuilder target • If the OOM file name is not specified a default file name, based on the PowerBuilder target name, will be used • If the OOM file name is specified and it is not found a new OOM file will be generated • You are able to choose the objects you want to reverse engineer • You are M E R G I N G the changes with the existing OOM • The OOM is opened within the PowerBuilder DIE • Changes done in PowerBuilder are reflected in the OOM automatically • Changes done in PowerDesigner are N O T reflected in PowerBuilder automatically
Reverse Engineering for PowerBuilder • Reverse Engineering Issues • When you delete/rename a PowerBuilder Library in a PowerBuilder Target • When you delete/rename a PowerBuilder object • When you delete/rename a function or event • When you delete/rename a variable or property • When you change the number of parameters in a function or event • You will discover that unused packages, Classes, Operations and Attributes will still remain in the OOM when you do a reverse engineering again, because the default behaviour in PowerDesigner is to M E R G E the changes with the existing OOM.
Solution? • Apply the “Replace existing OOM” option • When you want to remove unused packages, classes,attributes or operations • System will delete existing OOM file before reverse engineering • Apply the “Replace existing Packages or Classes” option • When you want to remove unused classes,attributes or operations • System will delete the corresponding classesof the selected objectsbefore reverse engineering • N O T available in PB10beta2
Designing PowerBuilder Applications • You can create, modify or delete objects or links. • You can use the PowerBuilder tool palette to create objects. • You can preview the PowerBuilder code. • You can modify the PowerBuilder code in the code preview window. From ‘outside’ the Plug-In: • You can write specification in RTF format. You could use Word to edit the description or annotation. • You can generate reports in HTML or RTF formats for documentation.
Functions and Events • Function and Events are represented as operations. • An Event could be an operation with the «event» stereotype, with a language event or with an extended attribute EventID (pbm_*).
Overriding Properties • In the Attributes tab of the class property sheet, the Inherited button allows you to select the properties to override.
Previewing PowerBuilder Code • Open the properties of an object. Select the Preview tab. • For Window, User Object, Application, Structure, Function and Proxy, the code is generated from the class definition. You could change the code in the Preview window (add attributes, modify operations, …), the model will be updated to reflect the changes. • For DataWindow, Menu, Query, …, you could change the code in the Script tab
Verifying the Model • You could use the Check Model function to verify if the model is well defined. • There are PowerBuilder specific checks. • Check model is customized for PowerBuilder, for example, it will check whether a object name is valid PowerBuilder name, a pbl can only have one application object • Check model results are printed in output window
Generate from PowerDesigner • Generate PowerBuilder Code • Select packages and classes from OOM to generate PowerBuilder code • If it is the first time to generate PowerBuilder code, a new PowerBuilder target will be created
Navigation • From PowerBuilder to PowerDesigner • Select “Open Class Diagram” from pbl context menu to open class diagram for this pbl • Select “Find in Class Diagram” from PB object context menu to find the corresponding class in class diagram • From PowerDesigner to PowerBuilder • Double click a class in class diagram to launch PowerBuilder painter to open corresponding PB object • Select “Find in PowerBuilder Workspace” from class context menu to find the corresponding PowerBuilder object in PowerBuilder workspace
PowerDesigner and PowerBuilder Together Design in PowerDesigner Generate PowerBuilder Code Modify in PowerBuilder Debug and Run Reverse Engineer to Update Class Diagram
Summary • PowerDesigner: A Plug-In Component in PowerBuilder 10 • Reverse Engineer From PowerBuilder • Design and Generate PowerBuilder Code Using PowerDesigner • Navigation Between PowerDesigner and PowerBuilder • Demo
PowerBuilder 10 and PowerDesigner 10 Berndt Hamböckhamboeck@pocketpb.com