Download presentation
Presentation is loading. Please wait.
Published byKristian Doyle Modified over 9 years ago
1
® IBM Software Group © 2009 IBM Corporation Essentials of Modeling with IBM Rational Software Architect, V7.5 Module 18: Applying Patterns and Transformations
2
2 Applying patterns and transformations Objectives: Apply reusable assets in the development process. Apply a pre-built design pattern in Rational Software Architect. Perform model transformations –Forward transformations –Reverse transformations
3
3 Where are we? Asset- and pattern-based development Applying design patterns Applying transformations Packaging reusable assets
4
4 What is a pattern? A solution to a recurring problem in a given context. Patterns abstract a way of solving a design problem from the details of any particular technology A pattern: Provides a solution to a specific problem Requires a strategy for applying the pattern in its context. Comes with consequences (advantages and disadvantages) of applying the pattern.
5
5 Benefits of using patterns Patterns: Increase productivity Simplify and accelerate building and testing Eliminate repetitive work Make development easier and more instructive for beginners Improve software governance, for: Achieving architecture consistency Enforcing architectural decisions Enforcing design and coding standards Increase quality Apply best practices for functional and non-functional requirements Leverage expert skills within the development organization Increase openness Reuse and share existing architectural specifications Create less dependency on a specific tools vendor or platform
6
6 Patterns in Rational Software Architect Three features for automating model development with patterns: Design Patterns: Add details to the model. Provide model markup and structures that can be transformed into code. Observer pattern Session Facade pattern Transformations: Translate elements from one model into elements in a different model 1. Model-to-model 2. Model-to-code 3. Code-to-model Java Emitter Templates (JET) transformations: a type of transformation that provides customizable, text-based transformations and code templates Transformations Pattern 1 2 3
7
7 The Pattern Explorer view Design Pattern Transformation JET Transformation Right-click to apply, copy, move, or configure the pattern, or to view documentation. Icons in the Pattern Explorer view
8
8 Accelerating model-driven development Platform- Independent Model Code-based Development Apply Patterns ITERATE Forward Transform (embedded patterns) Reverse Transform (embedded patterns) Apply Patterns Forward Transform (embedded patterns) Reverse Transform (embedded patterns) Forward Transform (embedded patterns) Reverse Transform (embedded patterns) Forward Transform (embedded patterns) Reverse Transform (embedded patterns) Application Design (high abstraction) Implementation Application Use-Cases Application Analysis Computational Independent Model Platform- Specific Model Business Analysis Business Process Models Business Use-Cases Model-Driven Architecture RUP Methodology Platform-specific model markup
9
9 Reuse sets of artifacts: reusable assets A reusable asset is an organized collection of artifacts that provides a solution to a problem for a given context. A reusable asset contains: Artifacts: Patterns, transformations, profiles, pluglets, model templates, and so on. Variability points: Allow users to customize the asset for a specific project Artifact Variability Point Problem Solution
10
10 Asset-driven development Reuse requirements, design, test, and deployment assets to develop new or enhance existing applications Supported by IBM ® Rational ® products with: Process guidance Tooling Standards Assets Asset Management Asset Production Asset Consumption Feedback Asset Identification Candidate Asset Program Management The Asset Lifecycle
11
11 Where are we? Asset- and pattern-based development Applying design patterns Applying transformations Packaging reusable assets
12
12 Design patterns in Rational Software Architect A design pattern in Rational Software Architect adds details to a model automatically. Use design patterns to add: Model elements and relationships Classes, packages, and so on Details to model elements Attributes, operations Markup to the model Stereotypes from a UML profile recognized by transformations A design pattern: Has parameters that are used to bind the pattern to the model Can be reapplied to or unbound from the model Usually affect small areas of the model when applied
13
13 Design pattern notation Parameters Pattern Instance A UML Collaboration Binding Indicator Parameter Type Multiplicity Bound Arguments
14
14 Applying a design pattern Create a pattern instance by dragging a pattern from the Pattern Explorer view to an open diagram, or to a model in the Project Explorer view. 1 Drag an existing class from the diagram or Project Explorer view to a pattern parameter to make it an argument of the pattern, or… 2 Use the action bar to create an argument value for a parameter. 3
15
15 Gang of Four (GoF) design patterns Rational Software Architect has the 23 GoF design patterns built in: Can be used as the basis for custom patterns These patterns support widely recognized best practices Help seed the code with transformation extensions Example Observer is a GoF behavioral design pattern: One-to-many dependency between objects When one object changes state, observers are notified and updated automatically
16
16 Demo: Applying a design pattern The instructor will now show you how to: Select the pattern Create a pattern instance Bind new elements to the pattern Bind existing elements to the pattern
17
17 In this lab, you will complete the following tasks: Examine the Patterns Explorer view Apply a design pattern Lab 18.1: Apply patterns To begin the lab: In the workbench, click Help > Cheat Sheets to open the Cheat Sheet Selection dialog. Expand Essentials of Modeling Labs. Double-click 18 Apply patterns and run transformations. Select Apply patterns in the Cheat Sheet view Follow the directions indicated on the Cheat Sheet.
18
18 Where are we? Asset- and pattern-based development Applying design patterns Applying transformations Packaging reusable assets
19
19 Transformations Transformations create elements in a target model (domain) based on elements from a source model Often, the source domain is more abstract than the target domain Examples: Based on a use-case model, create an analysis model that realizes the use cases following a modeling standard Based on the analysis model, create a design model that incorporates elements of the company’s security and persistence frameworks, and follows a modeling standard Starting with a UML model, apply a built- in transformation to create code elements Take existing code and apply a transformation to abstract out the design elements. Transformations
20
20 Transformations in Rational Software Architect The following transformations are built in to Rational Software Architect: UML to UML UML to LDM UML to code UML to Java V1.4 UML to Java V5.0 UML to C++ UML to EJB UML to WSDL UML to XSD Code to UML C++ to UML Java to UML Transformations can be custom built using the Plug-in Development Environment.
21
21 Running a transformation Create a new instance (configuration) of the transformation Choose an appropriate project target Choose how to manage source-to-target traceability Transformation Configuration Source Transformation Target
22
22 Create a transformation configuration A transformation configuration is an instance of a transformation with a specific: Name Source Target
23
23 Synchronization properties Control source and target synchronization with the Protocol setting: Conceptual: Changes in the source are propogated to the target (source-focused) Mixed: Transformed elements in the source are replaced with references to target elements (target-focused) Reconciled: Source and target evolve independently and need to be synchronized Enables the reverse transformation
24
24 Reconciliation: Merge the transformed model The combine dissimilar models feature is used when you apply a reverse transformation to update a conceptual model from code. Pending Changes Mark changes from source model to be applied to target model. Pending Changes Mark changes from source model to be applied to target model. Source Model Target Model Change Description
25
25 UML visual development C++ and Java code can be visualized with class and sequence diagrams Changes to the code update the diagram Changes to the diagram update the code Harvest classes into UML models
26
26 Concurrent code and model development Reverse transformations allow for the concurrent development of UML models and code Architecture V1.0 Architecture V1.1 Architecture V1.1+ Reconcile UML Model of Implementation v1.1 Implementation V1.0 Implementation V1.1 Implementation V1.1+ Model Combine Accepted change Reverse Transformation Iterate Forward Transformation (omit rejected change) Iterate Introduce an architectural deviation Forward Transformation
27
27 Demo: Apply a transformation The instructor will now show you how to: Create a UML to Java transformation Transform UML classes to Java classes Review the code
28
28 In this lab, you will complete the following tasks: Create a transformation Transform UML classes to Java code Review the code Modify a generated Java class and reconcile the code with the UML model Lab 18.2: Run a UML to Java transformation To begin the lab: In the workbench, click Help > Cheat Sheets to open the Cheat Sheet Selection dialog. Expand Essentials of Modeling Labs. Double-click 18 Apply patterns and run transformations. Select Run a UML to Java Transformation in the Cheat Sheet view Follow the directions indicated on the Cheat Sheet.
29
29 Where are we? Asset- and pattern-based development Applying design patterns Applying transformations Packaging reusable assets
30
30 Building custom artifacts Supporting creation of these artifacts in Rational Software Architect are: The Plug-in Development Environment (PDE) Reusable Asset Specification (RAS) Import and Export Plug-insPlugletsModel Templates UML Profiles Transformations Design Patterns
31
31 Sources for artifacts Patterns, transformations, and other artifacts are not limited to artifacts you create for yourself. They can come from a variety of sources. IBM Rational Software Peer Groups Your Group Third-Party Software Companies Solution in Rational Software Architect
32
32 Patterns and transformations as reusable assets Related patterns and transformations can be grouped in libraries. Patterns and transformations can reside in the same Eclipse plug-in. Plug-ins can be grouped and exchanged in RAS format. Eclipse Plug-in Patterns Library RAS Asset Eclipse Plug-in Patterns Library
33
33 Review How many levels of abstraction are needed when creating a software solution? What is a pattern? What tools exist to help build your own patterns?
34
34 Further information Web sites Books Articles
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.