Sie sind auf Seite 1von 40

Rational Rose Making use of UML Elements Tutorial

Huscar A. Snchez
Lect 1: Rational Rose Tutorial 1

Objectives

Get to know Rational Rose Get Familiar with general functions of Pointed by Rational Rose for Modeling an icon Create a Class Diagram with Rational Rose

1st Part: Guided 2nd Part: Student

Lect 1: Rational Rose Tutorial

Lab Objective: Graphic Model


Specify the Graphics Class Diagram:
Panel Graphic DrawPoint(p : Point) DrawLine(p1 : Point, p2 : Point) DrawCircle(c : Point, r : Float) OnPaint(e : PaintEvent) #graphics 0..n Draw(aPanel : Panel) : void Move(to : Point) : void 1.. n -s lection e

Lin e start : Point end : Point Draw(aPanel : Panel) : void Move(to : Point) : void

Recta ngle anchor : Point size : Point Draw(aPanel : Panel) : void Move(to : Point) : void

Circle origin : Point radius : Float Draw(aPanel : Panel) : void Move(to : Point) : void GraphicSelection Dra w(aPa ne l : Pan el) : voi d Mo ve (to : Poin t) : v oid Ad d(g : Graph ics) : vo id Re move(g : Grap hi cs) : Grap hi c Ge tChil dren (n am e : S tri ng ) : G ra ph ic

Lect 1: Rational Rose Tutorial

Graphic Objects
Circle

Graphic Selection Panel

Lect 1: Rational Rose Tutorial

Graphic Model: UML Elements


Association
Panel DrawPoint(p : Point) DrawLine(p1 : Point, p2 : Point) DrawCircle(c : Point, r : Float) OnPaint(e : PaintEvent)
navigability

Abstract Class Aggregation


role
Graphic -s lection e 1.. n 0..n Draw(aPanel : Panel) : void Move(to : Point) : void

#graphics

multiplicity

Dependency Generalization attribute

Abstract operation

Concrete Class
Lin e start : Point end : Point Draw(aPanel : Panel) : void Move(to : Point) : void Recta ngle anchor : Point size : Point Draw(aPanel : Panel) : void Move(to : Point) : void Circle origin : Point radius : Float Draw(aPanel : Panel) : void Move(to : Point) : void GraphicSelection Dra w(aPa ne l : Pan el) : voi d Mo ve (to : Poin t) : v oid Ad d(g : Graph ics) : vo id Re move(g : Grap hi cs) : Grap hi c Ge tChil dren (n am e : S tri ng ) : G ra ph ic

Concrete operation
Lect 1: Rational Rose Tutorial

Start Rational Rose

Start Rose

Start Programs Rational Rose

Rational Rose

Lect 1: Rational Rose Tutorial

Create a New Model


When Rose is started When Rose has been started: File New

Lect 1: Rational Rose Tutorial

Create a New Model

From Scratch Cancel the loaded window Using a Template or Frame-work Select <model> OK From File System Existing
OR

Recent

Lect 1: Rational Rose Tutorial

To Save a Model

File Save o Save As

Lect 1: Rational Rose Tutorial

Create a Class Diagram

Browser: Logical View Right Button Menu New Class Diagram Menu : Browse Class Diagram

Lect 1: Rational Rose Tutorial

10

Creating more Diagrams

Select <View> in Browser

Right Button Menu New <diagram>

Browse Menu <diagram>

Lect 1: Rational Rose Tutorial

11

Toolbar for Class Diagrams

Any element of a diagram can be created by placing the mouse pointer over a Tool in the Toolbar Drag&Drop over the diagram canvas

text Note class Pointer Note Anchor interface asociation generalization package dependency or instantiation Association class
Lect 1: Rational Rose Tutorial

realization

12

Create a Class

Place mouse pointer on Class Tool


Toolbar : Click Class button Icon Menu: Tools Create Class

Click on Diagram Window OR Browser : Sel. Logic View right button menu New Class (Sel. Clase Drag &Drop over Diagram Window)

Lect 1: Rational Rose Tutorial

13

Create Diagram Elements

Place Mouse Pointer


Click on Toolbar button Sel. Diagram in Browser right button New <element> Menu Tools Create

Click on diagram

Lect 1: Rational Rose Tutorial

14

Specify Class Name


Directely in the diagram Double click on the class Class Specification for NewClass

Lect 1: Rational Rose Tutorial

15

Specify Diagram Elements

Specification Window

Allows you to specify a model element (diagrams, classes, packages, relationship...)

The attributes or subelements to be specified depend on the selected element

In each TabWindow attributes and sub-elements would be specified

Lect 1: Rational Rose Tutorial

16

Specify Diagram Elements

Open Specification Window


Double Click on element via Browser or Diagram Window Sel. element (Browser,Diagram Window) Mouse right button menu Open Specification Sel. elemento Browse menu Open Specification

Shorcuts of TabWindows, Properties, WIndow Specification Menus

Sel. Element (Browser,Diagram Window) right button Menu new <subelement> (attribute, operation...) OR <Property> OR <TabWindow>

Lect 1: Rational Rose Tutorial

17

Class Graphic

An element Can be in multiple diagrams Only one instance in the Browser

Synchronized

Lect 1: Rational Rose Tutorial

18

Delete an Element

Shallow Delete

Edit Delete Select element in diagram key DEL


It is not deleted from the MODEL!! (only from the diagram, not from Browser)

Deep Delete

Select element in Browser click right button Delete Select element in diagram Click CTRL+D

It is deleted from the MODEL!! (It will disapear from the diagram and from the Browser)

Lect 1: Rational Rose Tutorial

19

Create an Operation

Diagram: Select class Mouse right button menu New Operation Browser: Select class Mouse right button menu New Operation

Lect 1: Rational Rose Tutorial

20

Specify an Operation

Directly: write the signature of the method

<< stereotype>> nameOperation( param: Typo,...) : Return Type

Indirectly: Class Specifcation tab Operations right button menu Insert


(operation)

Double click on method Operation Specification Name Details right button menu Insert (parameter)

Lect 1: Rational Rose Tutorial

21

Specify an Operation

Name Parameter

Name,Type
MyClassObject GetIsPublic() GetIsProtected() GetIsPrivate()

Return Type Accesibility

Public, Protected, Private

Abstract o Concrete

(checkbox Abstract in Details TabWindow)


Lect 1: Rational Rose Tutorial 22

Create an Attribute

Diagram: Select class Mouse right button menu New Attribute Browser: Select class Mouse right button menu New Attribute

Browser: would be updated in Diagram Window


Lect 1: Rational Rose Tutorial 23

Specify Attribute

Directly: write the signature of the attribute

<< stereotype>> nameAttribute : Type

Indirectly: Class Specification tab Attributes right button menu Insert


( attribute)

Double click on attribute Attribute Specification Name Type

Lect 1: Rational Rose Tutorial

24

Specify Attributes

Name Type Accesibility

MyCl ass isPublic isProtected isPrivate

Public, Protected,Private

Class Abstract or Concrete

(checkbox Abstract in Details TabWindow)

Lect 1: Rational Rose Tutorial

25

Class Relationships

UML Relationships in Rational Rose


Generalization Association

Aggregation

Composition

Dependency

Lect 1: Rational Rose Tutorial

26

UML Relationships in Rational Rose

Generalization (Inheritance) B Association


roleB roleA
1..n

A
multiplicity

B
Lect 1: Rational Rose Tutorial

A
Navegability from B to A
27

Relaciones UML en Rose

Aggregation A

Composition A

Dependency or Instantiation B
Lect 1: Rational Rose Tutorial

A
28

Create Generalization

Place Mouse Pointer over Tool


Click on button Toolbar Menu Tools Create Generalization

Click on Diagram Window Connect element B to A

Lect 1: Rational Rose Tutorial

29

Specify Generalization

Like the rest of the elements:


Double click on element Sel. element right button menu Open Specification or Shortcut of TabWindow/Property Sel. Sel element Browse menu Specification (note: it does appear on the Browser)

Lect 1: Rational Rose Tutorial

30

Create an Association

Place mouse pointer over Tool


Click on Toolbar button Menu Tools Create Generalization

Click on Diagram Window Connect element B to A

Lect 1: Rational Rose Tutorial

31

Specify Association

Like the rest of Elements: Double click, Sel (Browser Diagram Window) + Right Button Menu, Browse menu)

It will appear as another element else in the Browser


Lect 1: Rational Rose Tutorial 32

Specify Association

Specify

Navegability Accesibility

public (+), protected (#), private (-)


agregationName

Multiplicity (1..n, 0..n, etc...) Aggregation B Role names Association names Content Type:

-roleB 1

-roleA 0..n

Reference, Value, no specify

Lect 1: Rational Rose Tutorial

33

Model Organization

A model can be organized using packages


Graphic Model

(group, include model elements)

Folder Structure

Lect 1: Rational Rose Tutorial

34

Move Elements across Packages

Drag&Drop in each Package Browser from one to another


One to One Pay attention: by moving the classes it does not mean that associations will move as well!! (Rational Rose 2000>)

They are elements with Identity

Lect 1: Rational Rose Tutorial

35

Copy Cut Paste Elements between diagrams

Within the same Rational Rose model we are talking about the diagrams figures

The elements appearing in the Browser are the only elements in the entire model.

An element can appear in multiple diagrams

If it is a different package, indicate from where the package come from from <Package>
Graphic
(f rom Graph ic M odel)

Draw(aPanel : Panel) : void

Lect 1: Rational Rose Tutorial

36

Copy Cut Paste Elements between diagrams

Between two instances of Rational Rose Copy, Paste

create the new elements


If they dont exist in the model destination If they dont exist in the model destination, but the paste is in the package destination keep the existing if they exist in the model destination and the paste is in the same package

Lect 1: Rational Rose Tutorial

37

Exercise 1

Finalize the Graphics Model

Lect 1: Rational Rose Tutorial

38

Exercise 2

Model of a Work Plan (Project) - Overview


Project GanttView Resource
Duration Start Finish Sep 21, '03 F Sep 28, '03 S S M T W T F Oct 5, '03 S S M T W T F

ID 1 2 3 4 5 6 7 8 9 10 11

Task Nam e

Preparacin Fiesta Invitar Am igos Amigos Invitados Comprar Com prar Com ida Com prar Bebida Limpiar Casa Todo Preparado

4 days 1 day 0 days 3 days 2 days 3 days 1 day 0 days

Wed 10/1/03 Wed 10/1/03 Wed 10/1/03 Wed 10/1/03 Wed 10/1/03 Wed 10/1/03 Mon 10/6/03 Mon 10/6/03

Mon 10/6/03 Wed 10/1/03 Wed 10/1/03 Fri 10/3/03 Thu 10/2/03 Fri 10/3/03 Mon 10/6/03 Mon 10/6/03 10/6 RG 10/1

Dependency

TaskGroup

Task Milestone39

Lect 1: Rational Rose Tutorial

Exercise 2

Think in a class model that describe a workplan of a project using Software stability concepts Draw it with Rational Rose

Lect 1: Rational Rose Tutorial

40

Das könnte Ihnen auch gefallen