Hsanchez Rose Tutorial Fnl

Embed Size (px)

Citation preview

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    1/40

    Huscar A. Snchez

    Lect 1: Rational Rose Tutorial 1

    Rational Rose TutorialMaking use of UML Elements

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    2/40

    Lect 1: Rational Rose Tutorial 2

    Objectives

    Get to know Rational Rose

    Get Familiar with general functions of

    Rational Rose for Modeling Create a Class Diagram with Rational Rose

    1st Part: Guided

    2nd Part: Student

    Pointed by

    an icon

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    3/40

    Lect 1: Rational Rose Tutorial 3

    Lab Objective: Graphic Model

    Specify the Graphics Class Diagram:

    Line

    start : Poi nt

    end : Point

    Draw(aPanel : Panel) : voi d

    Move(to : Point) : void

    Rectangle

    anchor : Point

    size : Point

    Draw(aPanel : Panel ) : void

    Move(to : Point) : void

    Circle

    origin : Point

    radius : Float

    Draw(aPanel : Panel ) : void

    Move(to : Point) : voidGraphicSelection

    raw(aPanel : Panel) : void

    ove(to : Point) : void

    d d(g : Graphics) : void

    emove(g :G

    raphi cs) :G

    raphi cetChil dren(name : Stri ng) : Graphic

    Graphic

    Draw(aPanel : Panel) : void

    Move(to : Po int) : void1..n

    -se lecti on

    1..n

    Panel

    DrawPoint(p : Point)

    DrawLine(p1 : Point, p 2 : Point)

    DrawCircle(c : Point, r : Float)

    OnPaint(e : PaintEvent)

    0..n

    #graphics

    0..n

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    4/40

    Lect 1: Rational Rose Tutorial 4

    Graphic Objects

    Graphic Selection

    Circle

    Panel

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    5/40

    Lect 1: Rational Rose Tutorial 5

    Graphic Model: UML Elements

    Line

    start : Poi nt

    end : Point

    Draw(aPanel : Panel) : voi d

    Move(to : Point) : void

    Rectangle

    anchor : Point

    size : Point

    Draw(aPanel : Panel ) : void

    Move(to : Point) : void

    Circle

    origin : Point

    radius : Float

    Draw(aPanel : Panel ) : void

    Move(to : Point) : voidGraphicSelection

    raw(aPanel : Panel) : void

    ove(to : Point) : void

    d d(g : Graphics) : void

    emove(g : Graphi cs) : Graphi c

    etChil dren(name : Stri ng) : Graphic

    Graphic

    Draw(aPanel : Panel) : void

    Move(to : Po int) : void1..n

    -se lecti on

    1..n

    Panel

    DrawPoint(p : Point)

    DrawLine(p1 : Point, p 2 : Point)

    DrawCircle(c : Point, r : Float)

    OnPaint(e : PaintEvent)

    0..n

    #graphics

    0..n

    Generalization

    AggregationAssociation

    Abstract Class

    Concrete Class

    Concrete operation

    attribute

    Abstract operationDependency

    role

    multiplicity

    navigability

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    6/40

    Lect 1: Rational Rose Tutorial 6

    Start Rational Rose

    Start Rose

    Start p Programs p Rational Rose

    Rational Rose

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    7/40

    Lect 1: Rational Rose Tutorial 7

    Create a New Model

    When Rose is started

    When Rose has been started: File pNew

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    8/40

    Lect 1: Rational Rose Tutorial 8

    Create a New Model

    From Scratch

    Cancel the loaded window

    Using a Template or Frame-work

    Select

    OK

    From File System

    Existing

    OR

    Recent

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    9/40

    Lect 1: Rational Rose Tutorial 9

    To Save a Model

    File p Save o Save As

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    10/40

    Lect 1: Rational Rose Tutorial 10

    Create a Class Diagram

    Browser: Logical View p Right Button Menup Newp Class

    Diagram

    Menu : Browse p Class Diagram

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    11/40

    Lect 1: Rational Rose Tutorial 11

    Creating more Diagrams

    Select in Browser

    p Right Button Menu p Newp

    Browse Menup

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    12/40

    Lect 1: Rational Rose Tutorial 12

    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

    class

    interface

    asociation

    Association class

    packageNote Anchor

    dependency or instantiation

    Notegeneralization

    realization

    Pointer

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    13/40

    Lect 1: Rational Rose Tutorial 13

    Create a Class

    Place mouse pointer on Class Tool

    Toolbar : Click Class button Icon

    Menu: Tools p Createp Class

    p Click on Diagram Window

    OR

    Browser : Sel. Logic View p right button menup New Classp(Sel. Clasep Drag &Drop over Diagram Window)

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    14/40

    Lect 1: Rational Rose Tutorial 14

    Create Diagram Elements

    Place Mouse Pointer

    Click on Toolbar button

    Sel. Diagram in Browserp right buttonp New

    Menu p Toolsp Create

    p Click on diagram

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    15/40

    Lect 1: Rational Rose Tutorial 15

    Specify Class Name

    Directely in the diagram

    Double click on the class p Class Specification for

    NewClass

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    16/40

    Lect 1: Rational Rose Tutorial 16

    Specify Diagram Elements

    SpecificationWindow

    Allows you to specify a

    model element (diagrams,

    classes, packages,

    relationship...)

    The attributes or sub-

    elements to be specified

    depend on the selected

    element

    In each TabWindow attributes and sub-elements would be specified

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    17/40

    Lect 1: Rational Rose Tutorial 17

    Specify Diagram Elements

    Open Specification Window

    Double Click on element via Browser or Diagram Window

    Sel. element (Browser,Diagram Window)p Mouse right button menu p

    Open Specification

    Sel. elementop B

    rowse menup

    Open Specification

    Shorcuts of TabWindows, Properties, WIndow Specification Menus

    Sel. Element (Browser,Diagram Window)p right button Menu p new

    (attribute, operation...) OR OR

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    18/40

    Lect 1: Rational Rose Tutorial 18

    Class Graphic

    Synchronized

    An element

    Can be in multiple diagrams

    Only one instance in the Browser

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    19/40

    Lect 1: Rational Rose Tutorial 19

    Delete an Element

    Shallow Delete

    Edit Delete

    Select element in diagram p key DEL

    Deep Delete

    Select element in Browserp click right button p Delete

    Select element in diagram p Click CTRL+D

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

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

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    20/40

    Lect 1: Rational Rose Tutorial 20

    Create an Operation

    Diagram: Select class p Mouse right button menu p New

    Operation

    Browser: Select class p Mouse right button menu p New

    Operation

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    21/40

    Lect 1: Rational Rose Tutorial 21

    Specify an Operation

    Directly: write the signature of the method

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

    Indirectly: Class Specifcation p tab Operations p right button menu pInsert (operation)

    Double click on methodp Operation SpecificationpNamep Detailsp right button menup Insert (parameter)

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    22/40

    Lect 1: Rational Rose Tutorial 22

    Specify an Operation

    Name

    Parameter

    Name,Type

    Return Type

    Accesibility

    Public, Protected, Private

    Abstract o Concrete

    (checkbox Abstract in Details TabWindow)

    MyClassObject

    GetIsPublic()

    GetIsProtected()

    GetIsPrivate()

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    23/40

    Lect 1: Rational Rose Tutorial 23

    Create an Attribute

    Diagram: Select class p Mouse right button menu p New

    Attribute

    Browser: Select class p Mouse right button menu p New

    Attribute

    Browser: would be updated in Diagram Window

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    24/40

    Lect 1: Rational Rose Tutorial 24

    Specify Attribute

    Directly: write the signature of the attribute

    > nameAttribute : Type

    Indirectly: Class Specification p tab Attributes p right button menu p Insert (attribute)

    Double click on attributepAttribute SpecificationpNamep Type

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    25/40

    Lect 1: Rational Rose Tutorial 25

    Specify Attributes

    Name

    Type

    Accesibility Public, Protected,Private

    Class Abstract or Concrete

    (checkbox Abstract in Details TabWindow)

    MyClass

    isPublic

    isProtected

    isPrivate

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    26/40

    Lect 1: Rational Rose Tutorial 26

    Class Relationships

    UML Relationships in Rational Rose

    Generalization

    Association

    Aggregation

    Composition

    Dependency

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    27/40

    Lect 1: Rational Rose Tutorial 27

    UML Relationships in Rational Rose

    AB

    Association

    Generalization (Inheritance)

    AB

    AB

    1..n

    roleAroleB

    multiplicity

    Navegability from B to A

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    28/40

    Lect 1: Rational Rose Tutorial 28

    Relaciones UML en Rose

    Aggregation

    Dependency or Instantiation

    AB

    AB

    AB

    Composition

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    29/40

    Lect 1: Rational Rose Tutorial 29

    Create Generalization

    Place Mouse Pointer over Tool

    Click on button Toolbar

    Menu p Tools p Create Generalization

    p Click on Diagram Windowp Connect element B to A

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    30/40

    Lect 1: Rational Rose Tutorial 30

    Specify Generalization

    Like the rest of the elements:

    Double click on element

    Sel. element p right button menup Open Specification or

    Shortcut of TabW

    indow/Property Sel. Sel element p Browse menu p Specification

    (note: it does appear on the Browser)

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    31/40

    Lect 1: Rational Rose Tutorial 31

    Create an Association

    Place mouse pointer over Tool

    Click on Toolbar button

    Menu p Tools p Create Generalization

    p Click on Diagram Windowp Connect element B to A

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    32/40

    Lect 1: Rational Rose Tutorial 32

    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

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    33/40

    Lect 1: Rational Rose Tutorial 33

    Specify Association

    Specify

    Navegability

    Accesibility

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

    Multiplicity (1..n, 0..n, etc...)

    Aggregation

    Role names

    Association names

    Content Type: Reference, Value, no specify

    B A

    0..n1

    roleAagregationName

    0..n1

    -roleB

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    34/40

    Lect 1: Rational Rose Tutorial 34

    Model Organization

    A model can be organized using packages

    Graphic Model

    Folder Structure

    (group, include model elements)

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    35/40

    Lect 1: Rational Rose Tutorial 35

    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

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    36/40

    Lect 1: Rational Rose Tutorial 36

    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

    Graphic

    Draw(aPanel : Panel) : void

    (from Graphic M odel)

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    37/40

    Lect 1: Rational Rose Tutorial 37

    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

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    38/40

    Lect 1: Rational Rose Tutorial 38

    Exercise 1

    Finalize theG

    raphics Model

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    39/40

    Lect 1: Rational Rose Tutorial 39

    Exercise 2

    Model of a Work Plan (Project) - Overview

    ID TaskN

    ame Duration Start Finish

    1

    2

    3

    4 Preparacin Fiesta 4 days Wed 10/1/03 Mon 10/6/03

    5 Invitar Amigos 1 day Wed 10/1/03 Wed 10/1/03

    6 Amigos Invitados 0 days Wed 10/1/03 Wed 10/1/03

    7 Comprar 3 days Wed 10/1/03 Fri 10/3/03

    8 Comprar Comida 2 days Wed 10/1/03 Thu 10/2/03

    9 Comprar Bebida 3 days Wed 10/1/03 Fri 10/3/0310 Limpiar Casa 1 day Mon 10/6/03 Mon 10/6/03

    11 Todo Preparado 0 days Mon 10/6/03 Mon 10/6/03

    RG

    10/1

    10/6

    F S S M T W T F S S M T W TSep 28, '03 Oct 5, '03

    Task

    Milestone

    Dependency

    Resource

    TaskGroup

    Project

    GanttView

  • 8/3/2019 Hsanchez Rose Tutorial Fnl

    40/40

    Lect 1: Rational Rose Tutorial 40

    Exercise 2

    Think in a class model that describe a work-

    plan of a project using Software stability

    concepts

    Draw it with Rational Rose