- •Table of Contents
- •Mastering UML with Rational Rose 2002
- •Chapter 1: Introduction to UML
- •Encapsulation
- •Inheritance
- •Polymorphism
- •What Is Visual Modeling?
- •Systems of Graphical Notation
- •Booch Notation
- •Object Management Technology (OMT)
- •Unified Modeling Language (UML)
- •Understanding UML Diagrams
- •Business Use Case Diagrams
- •Use Case Diagrams
- •Activity Diagrams
- •Sequence Diagrams
- •Collaboration Diagrams
- •Class Diagrams
- •Statechart Diagrams
- •Component Diagrams
- •Deployment Diagrams
- •Visual Modeling and the Software Development Process
- •Inception
- •Elaboration
- •Construction
- •Transition
- •Summary
- •Chapter 2: A Tour of Rose
- •What Is Rose?
- •Getting Around in Rose
- •Parts of the Screen
- •Exploring Four Views in a Rose Model
- •Use Case View
- •Logical View
- •Component View
- •Deployment View
- •Working with Rose
- •Creating Models
- •Saving Models
- •Exporting and Importing Models
- •Publishing Models to the Web
- •Working with Controlled Units
- •Using the Model Integrator
- •Working with Notes
- •Working with Packages
- •Adding Files and URLs to Rose Model Elements
- •Adding and Deleting Diagrams
- •Setting Global Options
- •Working with Fonts
- •Working with Colors
- •Summary
- •Chapter 3: Business Modeling
- •Introduction to Business Modeling
- •Why Model the Business?
- •Do I Need to Do Business Modeling?
- •Business Modeling in an Iterative Process
- •Business Actors
- •Business Workers
- •Business Use Cases
- •Business Use Case Diagrams
- •Activity Diagrams
- •Business Entities
- •Organization Unit
- •Where Do I Start?
- •Identifying the Business Actors
- •Identifying the Business Workers
- •Identifying the Business Use Cases
- •Showing the Interactions
- •Documenting the Details
- •Creating Business Use Case Diagrams
- •Deleting Business Use Case Diagrams
- •The Use Case Diagram Toolbar
- •Adding Business Use Cases
- •Business Use Case Specifications
- •Assigning a Priority to a Business Use Case
- •Viewing Diagrams for a Business Use Case
- •Viewing Relationships for a Business Use Case
- •Working with Business Actors
- •Adding Business Actors
- •Adding Actor Specifications
- •Assigning an Actor Stereotype
- •Setting Business Actor Multiplicity
- •Viewing Relationships for a Business Actor
- •Working with Relationships
- •Association Relationship
- •Generalization Relationship
- •Working with Organization Units
- •Adding Organization Units
- •Deleting Organization Units
- •Activity Diagrams
- •Adding an Activity Diagram
- •Adding Details to an Activity Diagram
- •Summary
- •Chapter 4: Use Cases and Actors
- •Use Case Modeling Concepts
- •Actors
- •Use Cases
- •Traceability
- •Flow of Events
- •Relationships
- •Use Case Diagrams
- •Activity Diagrams
- •Activity
- •Start and End States
- •Objects and Object Flows
- •Transitions
- •Synchronization
- •Working with Use Cases in Rational Rose
- •The Use Case Diagram Toolbar
- •Creating Use Case Diagrams
- •Deleting Use Case Diagrams
- •Adding Use Cases
- •Deleting Use Cases
- •Use Case Specifications
- •Naming a Use Case
- •Viewing Participants of a Use Case
- •Assigning a Use Case Stereotype
- •Assigning a Priority to a Use Case
- •Creating an Abstract Use Case
- •Viewing Diagrams for a Use Case
- •Viewing Relationships for a Use Case
- •Working with Actors
- •Adding Actors
- •Deleting Actors
- •Actor Specifications
- •Naming Actors
- •Assigning an Actor Stereotype
- •Setting Actor Multiplicity
- •Creating an Abstract Actor
- •Viewing Relationships for an Actor
- •Viewing an Actor's Instances
- •Working with Relationships
- •Association Relationship
- •Includes Relationship
- •Extends Relationship
- •Generalization Relationship
- •Working with Activity Diagrams
- •The Activity Diagram Toolbar
- •Creating Activity Diagrams
- •Deleting Activity Diagrams
- •Exercise
- •Problem Statement
- •Create a Use Case Diagram
- •Summary
- •Chapter 5: Object Interaction
- •Interaction Diagrams
- •What Is an Object?
- •What Is a Class?
- •Where Do I Start?
- •Finding Objects
- •Finding the Actor
- •Using Interaction Diagrams
- •Sequence Diagrams
- •The Sequence Diagram Toolbar
- •Collaboration Diagrams
- •The Collaboration Diagram Toolbar
- •Working with Actors on an Interaction Diagram
- •Working with Objects
- •Adding Objects to an Interaction Diagram
- •Deleting Objects from an Interaction Diagram
- •Setting Object Specifications
- •Naming an Object
- •Mapping an Object to a Class
- •Setting Object Persistence
- •Using Multiple Instances of an Object
- •Working with Messages
- •Adding Messages to an Interaction Diagram
- •Adding Messages to a Sequence Diagram
- •Deleting Messages from a Sequence Diagram
- •Reordering Messages in a Sequence Diagram
- •Message Numbering in a Sequence Diagram
- •Viewing the Focus of Control in a Sequence Diagram
- •Adding Messages to a Collaboration Diagram
- •Deleting Messages from a Collaboration Diagram
- •Message Numbering in a Collaboration Diagram
- •Adding Data Flows to a Collaboration Diagram
- •Setting Message Specifications
- •Naming a Message
- •Mapping a Message to an Operation
- •Setting Message Synchronization Options
- •Setting Message Frequency
- •End of a Lifeline
- •Working with Scripts
- •Switching Between Sequence and Collaboration Diagrams
- •Exercise
- •Problem Statement
- •Create Interaction Diagrams
- •Summary
- •Chapter 6: Classes and Packages
- •Logical View of a Rose Model
- •Class Diagrams
- •What Is a Class?
- •Finding Classes
- •Creating Class Diagrams
- •Deleting Class Diagrams
- •Organizing Items on a Class Diagram
- •Using the Class Diagram Toolbar
- •Working with Classes
- •Adding Classes
- •Class Stereotypes
- •Analysis Stereotypes
- •Class Types
- •Interfaces
- •Web Modeling Stereotypes
- •Other Language Stereotypes
- •Class Specifications
- •Naming a Class
- •Setting Class Visibility
- •Setting Class Multiplicity
- •Setting Storage Requirements for a Class
- •Setting Class Persistence
- •Setting Class Concurrency
- •Creating an Abstract Class
- •Viewing Class Attributes
- •Viewing Class Operations
- •Viewing Class Relationships
- •Using Nested Classes
- •Viewing the Interaction Diagrams That Contain a Class
- •Setting Java Class Specifications
- •Setting CORBA Class Specifications
- •Working with Packages
- •Adding Packages
- •Deleting Packages
- •Exercise
- •Problem Statement
- •Creating a Class Diagram
- •Summary
- •Chapter 7: Attributes and Operations
- •Working with Attributes
- •Finding Attributes
- •Adding Attributes
- •Deleting Attributes
- •Setting Attribute Specifications
- •Setting the Attribute Containment
- •Making an Attribute Static
- •Specifying a Derived Attribute
- •Working with Operations
- •Finding Operations
- •Adding Operations
- •Deleting Operations
- •Setting Operation Specifications
- •Adding Arguments to an Operation
- •Specifying the Operation Protocol
- •Specifying the Operation Qualifications
- •Specifying the Operation Exceptions
- •Specifying the Operation Size
- •Specifying the Operation Time
- •Specifying the Operation Concurrency
- •Specifying the Operation Preconditions
- •Specifying the Operation Postconditions
- •Specifying the Operation Semantics
- •Displaying Attributes and Operations on Class Diagrams
- •Showing Attributes
- •Showing Operations
- •Showing Visibility
- •Showing Stereotypes
- •Mapping Operations to Messages
- •Mapping an Operation to a Message on an Interaction Diagram
- •Exercise
- •Problem Statement
- •Add Attributes and Operations
- •Summary
- •Chapter 8: Relationships
- •Relationships
- •Types of Relationships
- •Finding Relationships
- •Associations
- •Using Web Association Stereotypes
- •Creating Associations
- •Deleting Associations
- •Dependencies
- •Creating Dependencies
- •Deleting Dependencies
- •Package Dependencies
- •Creating Package Dependencies
- •Deleting Package Dependencies
- •Aggregations
- •Creating Aggregations
- •Deleting Aggregations
- •Generalizations
- •Creating Generalizations
- •Deleting Generalizations
- •Working with Relationships
- •Setting Multiplicity
- •Using Relationship Names
- •Using Stereotypes
- •Using Roles
- •Setting Export Control
- •Using Static Relationships
- •Using Friend Relationships
- •Setting Containment
- •Using Qualifiers
- •Using Link Elements
- •Using Constraints
- •Exercise
- •Problem Statement
- •Adding Relationships
- •Summary
- •Chapter 9: Object Behavior
- •Statechart Diagrams
- •Creating a Statechart Diagram
- •Adding States
- •Adding State Details
- •Adding Transitions
- •Adding Transition Details
- •Adding Special States
- •Using Nested States and State History
- •Exercise
- •Problem Statement
- •Create a Statechart Diagram
- •Summary
- •Chapter 10: Component View
- •What Is a Component?
- •Types of Components
- •Component Diagrams
- •Creating Component Diagrams
- •Adding Components
- •Adding Component Details
- •Adding Component Dependencies
- •Exercise
- •Problem Statement
- •Summary
- •Chapter 11: Deployment View
- •Deployment Diagrams
- •Opening the Deployment Diagram
- •Adding Processors
- •Adding Processor Details
- •Adding Devices
- •Adding Device Details
- •Adding Connections
- •Adding Connection Details
- •Adding Processes
- •Exercise
- •Problem Statement
- •Create Deployment Diagram
- •Summary
- •Chapter 12: Introduction to Code Generation and Reverse Engineering Using Rational Rose
- •Preparing for Code Generation
- •Step One: Check the Model
- •Step Two: Create Components
- •Step Three: Map Classes to Components
- •Step Five: Select a Class, Component, or Package
- •Step Six: Generate Code
- •What Gets Generated?
- •Introduction to Reverse Engineering Using Rational Rose
- •Model Elements Created During Reverse Engineering
- •Summary
- •Chapter 13: ANSI C++ and Visual C++ Code Generation and Reverse Engineering
- •Generating Code in ANSI C++ and Visual C++
- •Converting a C++ Model to an ANSI C++ Model
- •Class Properties
- •Attribute Properties
- •Operation Properties
- •Package (Class Category) Properties
- •Component (Module Specification) Properties
- •Role Properties
- •Generalization Properties
- •Class Model Assistant
- •Component Properties
- •Project Properties
- •Visual C++ and ATL Objects
- •Generated Code
- •Code Generated for Classes
- •Code Generated for Attributes
- •Code Generated for Operations
- •Visual C++ Code Generation
- •Reverse Engineering ANSI C++
- •Reverse Engineering Visual C++
- •Summary
- •Overview
- •Introduction to Rose J
- •Beginning a Java Project
- •Selecting a Java Framework
- •Linking to IBM VisualAge for Java
- •Linking to Microsoft Visual J++
- •Project Properties
- •Class Properties
- •Attribute Properties
- •Operation Properties
- •Module Properties
- •Role Properties
- •Generating Code
- •Generated Code
- •Classes
- •Attributes
- •Operations
- •Bidirectional Associations
- •Unidirectional Associations
- •Associations with a Multiplicity of One to Many
- •Associations with a Multiplicity of Many to Many
- •Reflexive Associations
- •Aggregations
- •Dependency Relationships
- •Generalization Relationships
- •Interfaces
- •Java Beans
- •Support for J2EE
- •EJBs
- •Servlets
- •JAR and WAR Files
- •Automated J2EE Deployment
- •Reverse Engineering
- •Summary
- •Starting a Visual Basic Project
- •Class Properties
- •Attribute Properties
- •Operation Properties
- •Module Specification Properties
- •Role Properties
- •Generalization Properties
- •Generated Code
- •Classes
- •Attributes
- •Operations
- •Bidirectional Associations
- •Unidirectional Associations
- •Associations with a Multiplicity of One to Many
- •Associations with a Multiplicity of Many to Many
- •Reflexive Associations
- •Aggregations
- •Dependency Relationships
- •Generalization Relationships
- •Reverse Engineering
- •Summary
- •Overview
- •Introduction to XML DTD
- •Elements
- •Attributes
- •Entities and Notations
- •Project Properties
- •Class Properties
- •Attribute Properties
- •Role Properties
- •Component Properties
- •Generating Code
- •Generated Code
- •Classes
- •Attributes
- •Reverse Engineering DTD
- •Summary
- •Project Properties
- •Class Properties
- •Attribute Properties
- •Operation Properties
- •Module Properties
- •Association (Role) Properties
- •Dependency Properties
- •Generated Code
- •Classes
- •Attributes
- •Operations
- •Bidirectional Associations
- •Unidirectional Associations
- •Associations with a Multiplicity of One to Many
- •Associations with a Multiplicity of Many to Many
- •Associations with Bounded Multiplicity
- •Reflexive Associations
- •Aggregations
- •Dependency Relationships
- •Generalization Relationships
- •Reverse Engineering CORBA Source Code
- •Summary
- •Chapter 18: Rose Data Modeler
- •Object Models and Data Models
- •Creating a Data Model
- •Logic in a Data Model
- •Adding a Database
- •Adding Tablespaces
- •Adding a Schema
- •Creating a Data Model Diagram
- •Creating Domain Packages and Domains
- •Adding Tables
- •Adding Columns
- •Setting a Primary Key
- •Adding Constraints
- •Adding Triggers
- •Adding Indexes
- •Adding Stored Procedures
- •Adding Relationships
- •Adding Referential Integrity Rules
- •Working with Views
- •Generating an Object Model from a Data Model
- •Generating a Data Model from an Object Model
- •Generating a Database from a Data Model
- •Updating an Existing Database
- •Reverse Engineering a Database
- •Summary
- •Chapter 19: Web Modeling
- •Modeling a Web Application
- •Web Class Stereotypes
- •Relationships
- •Reverse Engineering a Web Application
- •Generating Code for a Web Application
- •Summary
- •Appendix: Getting Started with UML
- •Building a Business Use Case Diagram
- •Building a Workflow (Activity) Diagram
- •Building a Use Case Diagram
- •Building an Interaction Diagram
- •Building a Class Diagram
- •Web Modeling
- •Adding Class Relationships
- •Building a Statechart Diagram
- •Building a Component Diagram
- •Building a Deployment Diagram
Chapter 2: A Tour of Rose
The Page Up and Page Down keys can now be used to scroll through a diagram.
∙
Default C++ component styles can be set.
∙
Directories and file extensions for C++ code generation can be specified.
∙
It includes support for Microsoft Interface Definition Library (MIDL) round−trip engineering.
∙
It includes support for J2EE deployment.
∙
It includes additional support for the reverse engineering of Enterprise JavaBeans (EJBs).
What's New in Rose 2001A
Some other new Rose features include:
∙
Business modeling, which was discussed briefly in Chapter 1, "Introduction to UML," focuses on the world around the system, and helps to set the context for the use case model.
∙
Activity diagrams, which can be used to describe the workflow through a business use case or the flow of events through a use case.
∙
Support for ANSI C++, which will be discussed in detail in the code generation and reverse engineering section of this book. A model converter can be used to convert older Rose C++ models to Rose ANSI C++ models.
∙
Tighter integration with Rational's ClearCase tool, which is used for version control.
∙
Enhanced data−modeling capabilities.
∙
Modeling, code generation, and reverse engineering of Enterprise Java Beans.
Getting Around in Rose
In the next few sections of this chapter, we'll describe each part of the Rose interface. Rose is largely a menu−driven application, with toolbars to help with commonly used features. Rose supports eight different types of UML diagrams: Use Case diagrams, Activity diagrams, Sequence diagrams, Collaboration diagrams,
30
Chapter 2: A Tour of Rose
Class diagrams, Statechart diagrams, Component diagrams, and Deployment diagrams. Rose will present you with a different toolbar for each of these diagrams. In the next nine chapters, we'll show you how to create all of these types of diagrams.
In addition to the toolbars and menus, Rose includes context−sensitive shortcut menus, visible by right−clicking an item. For example, right−clicking a class on a Class diagram will display a menu that includes options for adding attributes or operations to the class, viewing or editing the class specifications, generating code for the class, or viewing the generated code. When in doubt, right−click! Rose will almost always give you helpful menu options.
One of the easiest ways to get around in Rose is to use the browser, which is the treeview on the left side of the screen. With the browser, you can quickly and easily get to the diagrams and other elements of the model. If you run into trouble while using Rose, press F1 at any time to access the extensive online help file.
Parts of the Screen
The five primary pieces of the Rose interface are the browser, the documentation window, the toolbars, the diagram window, and the log. In this section, we'll look at each of these. Briefly, their purposes are:
Browser Used to quickly navigate through the model
Documentation window Used to view or update documentation of model elements
Toolbars Used for quick access to commonly used commands
Diagram window Used to display and edit one or more UML diagrams
Log Used to view errors and report the results of various commands
Figure 2.1 illustrates the various parts of the Rose interface.
Figure 2.1: The Rose interface
31
Chapter 2: A Tour of Rose
Browser
The browser is a hierarchical structure you can use to easily navigate through your Rose model. Anything you add to the model—actors, use cases, classes, components, and so on—will display in the browser. The
browser is shown in Figure 2.2.
Figure 2.2: Rose browser
Using the browser, you can
∙
Add model elements (use cases, actors, classes, components, diagrams, etc.)
∙
View existing model elements
∙
View existing relationships between model elements
∙
Move model elements
∙
Rename model elements
∙
32
Chapter 2: A Tour of Rose
Add a model element to a diagram
∙
Attach a file or URL to an element
∙
Group elements into packages
∙
Access the detailed specifications of an element
∙
Open a diagram
There are four views in the browser: the Use Case view, the Logical view, the Component view, and the Deployment view. Table 2.1 lists each of these views and the model elements found in the views.
Table 2.1: Views in Rational Rose
View |
Contents |
Use Case view |
Business actors |
|
Business workers |
|
Business use cases |
|
Business Use Case diagrams |
|
Business Use Case realizations |
|
Actors |
|
Use cases |
|
Associations |
|
Use case documentation |
|
Use Case diagrams |
|
Activity diagrams |
|
Sequence diagrams |
|
Collaboration diagrams |
|
Packages |
Logical view |
Classes |
|
|
33
Chapter 2: A Tour of Rose
|
Class diagrams |
|
Associations |
|
Interfaces |
|
Sequence diagrams |
|
Collaboration diagrams |
|
Statechart diagrams |
|
Packages |
Component view |
Components |
|
Interfaces |
|
Component diagrams |
|
Packages |
Deployment view |
Processes |
|
Processors |
|
Connectors |
|
Devices |
Deployment diagram
Using the browser, you can view the model elements in each of these four views, move or edit elements, or add new elements. By right−clicking an element in the browser, you can attach files or URLs to the element, access the detailed specifications of the element, delete the element, or rename the element.
The browser is organized in a treeview style. Each model element may contain other elements beneath it in the hierarchy.
By default, the browser will appear in the upper−left area of the screen. You can move the browser to another location or hide the browser altogether.
To show or hide the browser:
1.
Right−click in the browser window.
2.
Select Hide from the shortcut menu. Rose will show or hide the browser.
OR
Select View → Browser. Rose will show or hide the browser.
34
Chapter 2: A Tour of Rose
Documentation Window
The documentation window is used to document the elements of your Rose model. For example, you may want to write a short definition for each of your actors. You can enter this definition using the documentation window, as shown in Figure 2.3.
Figure 2.3: The documentation window
When you add documentation to a class, anything you type in the documentation window will appear as a comment in the generated code, reducing the need to go in later and comment on the system's code. The documentation will also appear in the reports you can generate from Rose.
As you select different elements from the browser or on a diagram, the documentation window will automatically be updated to display the documentation for the selected element.
Toolbars
Rose toolbars provide you with quick access to commonly used commands. There are two toolbars in Rose: the Standard toolbar and the Diagram toolbar, which is called the toolbox. The Standard toolbar contains options you can use in any diagram. These options are shown in Table 2.2.The toolbox changes for each type of UML diagram. The different Diagram toolbars will be discussed in detail in the remainder of this book.
Table 2.2: Icons in Standard Toolbar
Icon |
Button |
Purpose |
|
Create New Model |
Creates a new Rose model (.mdl) file. |
|
|
|
|
Open Existing Model |
Opens an existing Rose model (.mdl) file. |
|
|
|
|
Save Model or Log |
Saves the Rose model (.mdl) file or the log for the current model. |
|
|
|
35
Chapter 2: A Tour of Rose |
|
|
|
Cut |
Moves text to the clipboard. |
|
|
Copy |
Copies text to the clipboard. |
|
|
Paste |
Pastes text from the clipboard. |
|
|
Print Diagrams |
Prints one or more diagrams from the current model. |
|
|
Context Sensitive Help |
Accesses the help file. |
|
|
View Documentation |
Views the documentation window. |
|
|
Browse Class Diagram |
Locates and opens a Class diagram. |
|
|
Browse Interaction Diagram |
Locates and opens a Sequence or Collaboration diagram. |
|
|
Browse Component Diagram |
Locates and opens a Component diagram. |
|
|
Browse State Machine Diagram |
Locates and opens a Statechart diagram. |
|
|
Browse Deployment Diagram |
Opens the Deployment diagram for the model. |
|
|
Browse Parent |
Opens a diagram's parent diagram. |
|
|
Browse Previous Diagram |
Opens the diagram you were most recently viewing. |
|
|
Zoom In |
Increases the zoom. |
|
|
Zoom Out |
Decreases the zoom. |
|
|
Fit in Window |
Sets the zoom so the entire diagram fits within the window. |
|
|
Undo Fit in Window |
Undoes the Fit in Window command. |
All of the toolbars can be customized. To customize a toolbar, select Tools → Options, then select the Toolbars tab.
To show or hide the Standard toolbar:
1.
Select Tools → Options.
2.
Select the Toolbars tab.
3.
Use the Show Standard Toolbar check box to show or hide the Standard toolbar.
To show or hide the Diagram toolbar:
1.
Select Tools → Options.
2.
Select the Toolbars tab.
3.
Use the Show Diagram Toolbar check box to show or hide the Diagram toolbar (toolbox). |
|
To customize a toolbar: |
|
1. |
36 |
Chapter 2: A Tour of Rose
Right−click the desired toolbar.
2.
Select the Customize option.
3.
Add or remove buttons to customize the toolbar by selecting the appropriate button and then clicking the Add or Remove button, as shown in Figure 2.4.
Figure 2.4: Customizing a toolbar
Diagram Window
In the diagram window shown in Figure 2.5, you can view UML diagrams in your model. As you make changes to elements in a diagram, Rose will automatically update the browser as necessary. Similarly, when you make changes to an element using the browser, Rose will automatically update the appropriate diagrams. By doing so, Rose helps you maintain a consistent model.
Figure 2.5: Diagram window
Log
As you work on your Rose model, certain information will be posted to the log window. For example, when you generate code, any errors that are generated are posted in the log window, shown in Figure 2.6.
37