Qiu-xia Zhang

Subscribe to Qiu-xia Zhang: eMailAlertsEmail Alerts
Get Qiu-xia Zhang: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn

Related Topics: Java EE Journal

J2EE Journal: Article

Design and Develop Data-Centric Mobile Applications with PowerDesigner

Taking a higher-level view of an application's data management functionality

What do your applications do? They bring data flows in, send them out, store them somewhere or display them in various forms, and so on. There are many issues around data. Have you also found that a large part of your application's code manages or is driven by data? Aggregate, transform, classify, and compute... All of these actions suggest you adopt a more data-centric approach to software design and development.

In this article, we'll skim the basic concept of data-centric development and introduce PowerDesigner's all-sided support for it. It can include data modeling (the Physical Data Model - PDM), object-oriented modeling (OOM), Object-Relation Mapping (O/R Mapping) modeling, and code generation. Using a mobile application as an example, we'll show you a whole classic bottom-up process of data-centric development. It starts with data and ends in a complete application.

We'll go through the smooth-shifting steps of data modeling, O/R Mapping modeling, code generation, deployment, and running. In the end, you'll see the application running in a mobile device.

What Is Data-Centric Development?
Instead of treating functions as central and the data structures as support for the functions, think of your data as central. Put data at the center with code that supports it rather than the other way around. In essence, data-centric development emphasizes data (data definitions, structures, manipulations, and relations) over procedural functions and interfaces. Once the "data model" for your system takes shape, the path to software design becomes easier. PowerDesigner is just the tool for solving the data-management challenges for our design.

How to Do It
To do data-centric development, we can start using a more data-centric approach to define the data model for our application. The data flows into and out of our system present new appearances as tables, columns procedures, and so on. The data model can be manually created, transformed from other types of models, or reversed from the database schema. It depends on your situation and preferences.

OOM is also needed to blaze a way from the data model to the code.

To link the data model (PDM) and OOM, O/R Mapping frameworks come into play to map the PDM to the OOM. We have three ways to define this mapping, which can also be thought of as general approaches to data-centric development.
Top-down approach: Define the classes and then generate the database schema and O/R Mapping.
Bottom-up approach: Reverse engineer a database or define a new database schema and then generate the classes and O/R Mapping.
Meet-in-the-middle: Manually define O/R Mapping for the existing database schema and classes.

Here we'll focus mainly on the bottom-up approach. In this approach, models are transformed from PDM to OOM. It's significant for data-centric applications. Except for inheritance, PowerDesigner can transform PDM elements to OOM elements. Since PDM doesn't have the concept of subclasses, you can't generate inheritance links from reference keys and tables. However, you can customize the generated OOM to meet your needs.

After this these models and mappings have to be converted to source code and libraries. As we do so, we draw closer and closer to the final application. The last thing to do is get the required service libraries to deploy and run the application.

PowerDesigner's Contribution
PowerDesigner is a graphical and easy-to-use enterprise modeling environment. It supports several types of models including data modeling (PDM) and UML modeling (OOM). Different kinds of models can be linked, mapped, and transformed to each other. It provides automatic code generation through customizable templates. At the same time, it's an extensible environment, letting you add new rules, commands, concepts, and attributes to your modeling and coding methodologies. Among these, modeling, O/R Mapping, and code generation are the basis of PowerDesigner's support for data-centric development.

Data Modeling
Sometimes data modeling is the jumping-off point of data-centric development support, as when using the bottom-up approach. The data model is presented as a Physical Data Model in PowerDesigner. It models the overall physical structure of the database, taking into account DBMS software or data storage structure considerations. You can forward-generate database schemas or scripts from the data model.

Another attractive feature of PowerDesigner is its powerful reverse-engineering capabilities to document and update existing systems. Reverse engineering is the process of generating a PDM (or certain PDM objects) from an existing database schema. You can reverse-engineer an existing database schema into a new PDM or into an existing PDM.

Model Transformation
PowerDesigner provides model transformation functionality. This means the user can reuse the existing models. For PDM and OOM, this functionality is round-trip. You can generate PDM from OOM, or do it in the reverse direction.

Model comparison and merge functionality can be used to assist iterative model transformation. In the Compare window, you can see the objects contained in the models or resource files in a tree format and highlight differences between them. In the Merge window, you can do merge actions to retain or overlap the original objects.

O/R Mapping Modeling
In the PowerDesigner modeling environment we can establish mapping between various types of models, which can depict persistence states, such as mapping from the XML model to OOM, and mapping from OOM to PDM.

Table 1 lists object mappings in OOM and PDM model type. As we said, O/R Mappings can be defined in three ways: top-down, bottom-up, and meet-in-the-middle.

For O/R mapping framework support, PowerDesigner already provides support for several mainstream O/R Mapping frameworks, including Hibernate and EJB 3 for Java, NHibernate and ADO.NET for the .NET Framework, and ADO.NET Compact Framework for the .NET Compact Framework. They present a form of extended model definitions. These definitions supply settings and code generation for models and O/R Mapping implementation. You can easily make use of them in your development.

Figure 1 is the preview window of a generated mapping file for Hibernate support. The only thing you have to do is to define a proper O/R Mapping and setting.

There are also unit-testing extensions available for these O/R Mapping extended model definitions. Sometimes they're provided as part of the O/R tool (e.g., Hibernate) and sometimes they are available separately (e.g., UnitTest.NET for .NET and UnitTest.NET Compact Framework for .NET Compact Framework). You can also customize these extended model definitions or develop your own. For further details about this, refer to PowerDesigner's Advanced User Documentation.

More Stories By Qiu-xia Zhang

Qiu-xia Zhang is a software engineer in PowerDesigner Shanghai team at Sybase Corporation. She participates in development and test of some O/R mapping framework support including Hibernate, NHibernate, and ADO.Net Compact Framework, etc., for mobile application support.

More Stories By Xiao-guang Zhang

Xiao-guang Zhang is staff software engineer and team leader of the PowerDesigner Shanghai team at Sybase Corporation. His research interests include Workflow-based Business Process Management, Enterprise Modeling, SOA, Metadata management and Software Engineering. He received his PhD in computer science from Shanghai Jiaotong University, P.R.C.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.