Title: IA351 PowerDesigner and Java
1IA351PowerDesigner and Java
David Dichmann PowerDesigner Product
Manager IAD dichman_at_sybase.com
2PowerDesigner for Java Overview
- PowerDesigner for Java
- Brief Overview of the UML
- The PD OOM and the UML Class Diagram
- Building an OOM for Java
- Generating Java code
- Editing and Deploying Java from any IDE
- Round-Trip Iterative Design
- Persistence Modeling (RDBMS)
- Reporting and Repository
- Conclusion
3Brief Overview of UML
- Why Use Object-Oriented Modeling?
- Visually define and communicate the structure and
behavior of a software system - Represent systems using O-O concepts
- Abstraction Describe using relevant
characteristics - Encapsulation Combine Data and Methods
- Inheritance Supertype/Subtype
- Polymorphism Overloading and Overriding
- Link concepts to executable code
4Brief Overview of UML
- The UML consists of Nine Diagrams
- Static Class and Object diagrams
- Dynamic Use Case, Sequence, StateChart,
Collaboration and Activity Diagrams - Implementation Component, Deployment
- Java Code may be generated from the Class Diagram
5Class Diagram in UML
- Classes
- attributes, operations, constructors, accessors
- Abstract classes and Interfaces
- Relationships
- dependencies, generalizations/specializations,
associations, realizations - Stereotypes
- Describe extensions to UML
- Provide a way to further classify or define
objects with a common set of properties - Example ltltpersistentgtgt - State is preserved
6Class Diagram in UML
- Constructors and Destructors
- Default constructor public Class1()
- Others public Class1 (type Parm1)
- There is no Destructor operation for Java
- Accessor Methods
- Control the read/write access to Class attributes
- type getAttr() return attr
- void setAttr(type newAttr) attr newAttr
7The PowerDesigner Object Model
- The PowerDesigner Object Model (OOM) uses the UML
Class Diagram - Classes and Interfaces
- Attributes and Operations
- Associations and Generalizations (Realizes)
- Packages
- An OOM targeting Java
- Java aware (Multiple Inheritance, etc.)
- Generates .java files from model definitions
8Classes and Java
- PowerDesigners UML Classes
- Class Name at the top
- Attributes in the top half
- Operations in the Lower Half
- () and (-) indicate visibility, public and
private respectively
- Classes generate to .java files
9Classes and Java
///////////////////////////////////////////// //
This file was generated by PowerDesigner /////////
//////////////////////////////////// public
class Item public int getItemNumber ()
return itemNumber public String
getItemName () return itemName
public double getItemPrice ()
return itemPrice public Order
hasManyItems private int itemNumber
private String itemName private double
itemPrice
10Classes and Java
- Code Preview shows the work as it progresses
- Default Get/Set methods
- type getAttr1 () return attr1
- void setAttr1 (type newAttr1) attr1 newAttr1
- Constructor
- Default public Class1()
- Others public Class1 (type param1)
- Note Java does not use Destructors,
PowerDesigner will not create them
11Associations and Java
- Associations are the relationships between
classes (UML) - Implementation depends on the definition
- Multiplicity Is this a single reference or
array? - Navigability Is there a reference variable?
- Visibility Visibility of the reference variable
- Role Names Name given to the reference variable
- Code Preview shows the reference variable and
implementation
12Associations and Java
- Associations in PowerDesigner
- Generated Code
///////////////////////////////////////////// //
This file was generated by PowerDesigner /////////
//////////////////////////////////// public
class Address public Customer has
private int addCode private String street1
private String street2 private String city
private String zipCode
13Generalizations and Java
- Generalizations in UML describe an inheritance
structure - A Class extends another class
- public Class1 extends Class2
- PowerDesigner understands Inheritance and Java
- Check Model catches multiple inheritance
- Inherited button for Attributes - knows
Visibility - Inherited button for Operations -gt Override button
14Generalizations and Java
- Generalizations in PowerDesigner
///////////////////////////////////////////// //
This file was generated by PowerDesigner /////////
//////////////////////////////////// public
class Customer protected int customerCode
protected double creditStatus protected
double telNumber
///////////////////////////////////////////// //
This file was generated by PowerDesigner /////////
//////////////////////////////////// public
class Corporation extends Customer private
String companyName private String
contactName private double contactTelNumber
15Generalizations and Java
- PowerDesigner knows what is Inherited
16Interfaces and Java
- Interfaces
- Special abstract classes that do not contain any
implementation. - Designed to enforce a consistent behavior among
different classes that realize them. - Designed to replace multiple inheritance
- Follows an OO best practice guideline regarding
Multiple Inheritance, used in other OO languages
like C
17Interfaces and Java
- Interfaces in PowerDesigner
- Classes realize an interface
- Implement all abstract methods of the Interface
- Translates to Javas Implements syntax
- public Class1 implements Interface1
- Realization is the only relationship you may
create - To be implemented button for Operations
- Check Model catches Interface operations not
implemented
18Interfaces and Java
- Interfaces in PowerDesigner
public interface Peripheral abstract void
registerPeriph () abstract void testPort ()
abstract void testPwSupply () abstract void
testMotherBd ()
public class parallelPeripheral implements
Peripheral public void registerPeriph ()
public void testPort ()
public void testPwSupply ()
public void testMotherBd ()
private String periphId private String
periphCodeName private String vendorName
19Interfaces and Java
- Interface operations to be Implemented
20Packages and Java
- Packages in UML
- A logical container for objects that belong
together - Provides a way to partition and manage work
- Provides namespace scope for objects
- Packages in Java
- Directory structure containing objects
- Classes are known by their Package (path) and
class name - Packages in PowerDesigner
- Add model management capabilities
21Object Reuse in PowerDesigner
- Shortcuts
- PowerDesigner allows classes defined in one
package or model to be reused in other packages
and models via Shortcuts. - Shortcuts define an object that is outside the
model or package in question - Shortcuts may have associations and
generalizations drawn against it - Note You cannot have a shortcut inherit from a
class in your package or model violates model
management principals in PowerDesigner
22Generating Java Code
- Generate Java Code
- Options control location and format of generated
files - Use the Package structure defined in the Model
- External Shortcuts do not generate code
- The shortcut may be to a Library object - the
Class will already exist - The shortcut may be to another application or
project - the Class is outside the scope of the
model - If you own both models, generate code from both
23Editing Code in a Java IDE
- PowerDesigner does not generate complete code for
all objects - Class skeletons with Method stubs
- GUI components are hard to visualize at Design
Time - Generated .java files can be used in any IDE
- Add File in PowerJ
- Open in other Java Development Environments
- Visual Café, Visual Age, J, etc.
- Complete code, add GUI Components
- Reverse engineer into PowerDesigner to
synchronize external edits with model
24Deploying Code from a Java IDE
- Generated .java files may be built into any
Target - Standard .java classes
- Java Beans (with BeanInfo classes)
- Enterprise Java Beans (EJB - J2EE)
- Java Applications and Applets
- Java in the Database
- Stored Procedures
- Data Types
- Deploy to Sybase, Oracle, Informix
25Reverse Engineering Java Code
- Recover Java code
- Reverse engineer from a .java or .class file
- Select from individual files, a directory or an
archive - PowerDesigner can create a new OOM or extend an
existing one - Understand existing Java applications
- Capture a library for reference in other models
- Synchronize a model with externally edited code
- Incorporate new objects into an existing design
26Iterative Round Trip Engineering
- Build and test as the Design matures
- Create an OOM
- Generate Java code and edit in an IDE
- Reverse engineer edits into the Model
- Synchronize with the model
- Modify the Model
- Changes to the model can be done in parallel with
developer work outside PowerDesigner - Generate new Model to code
- Synchronize prevents loss of developers work
27Persistence Mapping (RDBMS)
- PowerDesigner also models RDBMS
- PowerDesigner is also a very powerful Relational
modeling tool - Bi-level Database Design
- PowerDesigner Physical Data Model (PDM)
- Database Specific Generates DDL
- PowerDesigner Conceptual Data Model (CDM)
- Normalized, Implementation (RDBMS) independent
28Persistence Mapping (RDBMS)
- Object/Relational Mapping
- UML Class Diagrams contain Entity/Relationship
metadata as well - Using identifiers, navigability, cardinality, we
can derive a Physical structure for persistent
objects - PowerDesigner knows which classes are persistent,
knows the cardinality, etc. and will generate a
CDM or PDM for the persistent objects
29Persistence Mapping (RDBMS)
- Use PowerDesigner to model the Applications
Logic and Persistence - Using the OOM Generate a PDM for your RDBMS
- Denormalize the PDM, add physical objects
- Triggers, Procedures, Views, Physical Options,
Indexes, etc... - Generate DDL for the Database (ODBC or Script)
- Iterative
- Changes to the OOM can be generated to the PDM
- The modified PDM can generate DDL and DML to
modify the database without loosing existing data.
30Java in the Database (RDBMS)
- Use PowerDesigner to model Java in the Database
- Create OOM for Java Stored Procedures and Java
Data Types - Create a PDM for the Database (Target your RDBMS)
- Reuse objects from the OOM in the PDM as Data
Types - Generate .java from the OOM to import to server
to support Data Types and add Stored Procedures
31Objects from Legacy Systems
- PowerDesigner captures existing database
structures and translates them to Java - Reverse engineer the Database to a PDM
- Generate an OOM from the PDM (Java)
- Gives Object Designers a view of existing
database objects - Jump-start to building Business Logic (new
applications) around legacy data stores - Iterative
- Build, generate and synchronize models as the
application takes shape
32Documentation and Reporting
- PowerDesigner provides comprehensive reporting
capabilities - Print Graphics to see model diagrams
- Create Report to include object metadata
- Multi-model report to span all models in a
workspace - Generate RTF or HTML reports
33Repository
- PowerDesigner has an optional repository for
model sharing and management - Consolidation/Extraction of Models
- Versioning
- Branching
- Configurations
- Open Database
- Write your own reports using SQL or other
reporting tools (InfoMaker, Crystal Reports, etc)
34Conclusion
- PowerDesigner for Java
- OO Analysis and Design for Java targets
- UML Class Diagram as the PD OOM
- Java code generation
- Deploy to Front End, Middle Tier, Database
- Persistence modeling with RDBMS specific PDM
- Full Round-Trip Iterative Development of
Applications (including persistence) - Documentation and Reporting for metadata analysis
- Scalable to the Enterprise