April 01, 2002
Modeling XML ApplicationsIf your company decides to switch from J2EE to Microsoft's .NET, will your system's design survive the migration? The answer is yes, if you build in resilience from the start by using a model-driven architecture. Part 2 of 4.David Carlson
Models are an essential part of system analysis and design, be they specified in UML or defined by the structure of software artifacts such as XML schemas. However, models that are tied too closely to today's deployment technology may be short-lived. If your company decides to switch from J2EE to Microsoft's .NET, will your system's design survive the migration? The answer is yes, if you build in resilience from the start by using a model-driven architecture (MDA). MDA enables a separation of domain models from specific deployment platforms.
Read part 1, part 2, part 3 and part 4.
Models are an essential part of system analysis and design, be they specified in UML or defined by the structure of software artifacts such as XML schemas. However, models that are tied too closely to today's deployment technology may be short-lived. If your company decides to switch from J2EE to Microsoft's .NET, will your system's design survive the migration? The answer is yes, if you build in resilience from the start by using a model-driven architecture (MDA). MDA enables a separation of domain models from specific deployment platforms (see OMG's MDA resources at www.omg.org/mda).
Model Transformation
Platform-specific models are designed to meet the unique needs of a deployment environment and its users. For example, the human readability of XML documents is often an important consideration, and specific design choices must be made that aren't relevant in a platform-independent model. One specification doesn't define all requirements as the design process moves toward the right in this diagram (see "From the Universal to the Specific"). However, at least in the case of XML schema design, it's possible to automate most or all of these transformations, optionally supplemented by human guidance. I've found it helpful to think in terms of model transformation instead of code generation when creating tools that support XML application design. Implementations in XML Schema, Java or SQL DDL are all models specified using their respective metamodels. To generate an XML Schema from UML, I transform an instance of the UML metamodel to an instance of the XML Schema metamodel. I also transform from one model to another when I reverse-engineer a schema to UML. Thus, a platform-specific model for XML Schema within UML should have an unambiguous transformational mapping to or from structures in the XML Schema language. But there's more than one way to skin a cat, and this choice is also related to the way in which the PSM is mapped to a PIM in UML. Let's compare two techniques for defining this mapping.
Mapping With a UML Profile When reverse-engineering a previously defined XML Schema to UML, I create a logical domain model that includes profile definitions required to re-create an equivalent schema. The PSM may not be structurally identical to the schema (for example, a child element in XML may be mapped to a UML attribute), but the profile stereotypes and tags capture this difference. Then, to create a PIM, I simply remove the XML-specific profile information from this view in UML. In an alternative approach, I define a PSM that is structurally identical to the implementation language. In a relational database, the PSM includes a one-to-one correspondence between classes in UML and tables in the database. The platform-specific model in UML also includes attributes for all primary and foreign keys, and separate classes are included for many-to-many associations. However, this PSM may not represent the good conceptual-level view desired for a PIM domain model. A conceptual view should be close to the terms and structure used by human experts, whereas the PSM must conform to the implementation language. So, to map between the PIM and PSM using this approach, the UML classes and relationships may require significant structural transformation, in addition to the use of a UML profile. This second approach is used by the Rational Rose UML modeling tool for both database modeling and DTD modeling. Rose does not yet include support for XML Schemas. In the case of the Rose PSM for DTD design, each child element in the XML structure is represented as a first-class object in UML, even if it represents a simple string value. To create a PIM from a reverse-engineered model, the PSM must be transformed to a more logical object-oriented structure. As a result, the PIM and PSM are two completely separate model instances, or possibly two packages within a parent model.
Purchase Order PIM Using a W3C XML Schema for xCBL as the starting point, I took the following steps to transform the model, using the mapping approach previously described.
All of these transformations focus on UML class diagrams that represent models of the information content specified with XML schemas. However, the same MDA approach applies equally well to the service interface, message interaction and business process models that are essential to Web services. Many of the early Web services implemented using SOAP are limited to simple request-response transactions. A set of related transactions managed within a complete business process is often referred to as an orchestration or choreography by B2B software vendors. As a complement to a sequence diagram, a UML activity diagram could be created for the larger business process model; this would also be a PIM that's independent of its implementation in a particular workflow execution environment. There are several proposed representation languages for process models, in addition to many proprietary workflow engine APIs. Two of the contenders for process flow definitions in XML format are closely coupled to other Web service specifications-XML Schema is used to define message content, and WSDL defines interfaces to process activities. The Web Services Flow Language (WSFL) is proposed by IBM, and the XLANG process design language is proposed by Microsoft. Their tight coupling with Web services enables these process models to be used as implementation languages for process management. I hope that these alternative proposals for process modeling languages will be combined and submitted to a standards body. However, by using UML to capture a platform-independent process model, it may be possible to generate several process languages from a common specification.
Driven or Assisted? Also, many developers prefer to work within the platform-specific technologies that they know and love. XML designers think in terms of XML-driven architecture. Some see UML as a useful tool for producing diagrams of their schemas and for assisting the integration of heterogeneous systems. Others see UML as a good modeling tool for generating XML schemas, but may not use it for generating associated Java code.
Yet the vision behind MDA is still a useful one. In keeping with the current spirit of agility, we need to make practical use of all design artifacts with a minimum of fuss, and focus on delivering systems that work. Instead of viewing the model-driven architecture approach shown in "From the Universal to the Specific" as necessarily relying on platform-independent models that are created in the beginning, I take a pragmatic approach and think in terms of model-assisted designin which you can start at any point in the development process, transforming your application model to other representations. In my next two articles in this series, we'll continue the discussion of these transformation techniques for XML.
|
|
|||||||||||||||||||||||||||||||
|
|
|
|