Revised Rational Rose2K UML

download Revised Rational Rose2K UML

of 15

Transcript of Revised Rational Rose2K UML

  • 8/13/2019 Revised Rational Rose2K UML

    1/15

    Rational Rose 2002 tutorial

    C:\Documents and Settings\Administrator.WORKSTATION03\Desktop\Rose\RationalRose2002_UML2\RationalRose2002_

    UML.doc

    Page 1 of 15

    Orientation Manual- Rational Rose2002 Enterprise Edition UML versionRational Rose is a CASE tool for object-oriented analysis, design and construction.

    In this tutorial, we use UML notation for our modeling. At the end, we can convert UML (UnifiedModeling Language) notation to the standard notation of Booch or the OMT (Object Modeling Technique)

    notation. If you already have a design in Booch or OMT, you can change it to the UML format by

    opening that project, click on View and choose as Unified .

    1.Open rational software from the all Programs menu in the start of the desktop or from the short cut on the

    desktop In the rational software open Rational Rose Enterprise Edition .. Ignore the first screen by selecting cancel.

    2. Rational Rose main window consists of three basic windows (the browser window, the diagram

    window and the documentation window) and the toolbox.

    3. Set for the UML Notation by going to the View menu on top of the screen and selecting AsUnified.

    If the As Unified menu item does not appear, the system is already set to UML notation. You may

    need to do this each time you log on.

  • 8/13/2019 Revised Rational Rose2K UML

    2/15

    Rational Rose 2002 tutorial

    C:\Documents and Settings\Administrator.WORKSTATION03\Desktop\Rose\RationalRose2002_UML2\RationalRose2002_

    UML.doc

    Page 2 of 15

    Use Casecommunicates the functionality (use cases) of the system using actors

    (anyone or anything interacting with the system) and relationships between cases

    and actors. Use cases provide a way to describe system behavior.To create actors:

    Right-click on the Use Case View package in the browser and select New, and then select Classin the new.

    A new actor called New Class is placed in the browser.

    Enter the desired name of the actor.

    Create Student, Billing System and Professor actors.

    Documenting actors in Rational Rose:

    Click on View and make sure Documentation has a check mark. If not, highlight it and hit enter.

    Click to select any actor in the browser window.

    An empty documentation window appears on the lower left of screen. Position the cursor in the

    documentation window and enter any comments. Add documentation for the three actors.

    Creating Use Cases:

    Right-click on the Use Case View in the browser and Select the New and then select UseCase in the

    new menu option. A new use case, called NewUseCase,is placed in the browser.

  • 8/13/2019 Revised Rational Rose2K UML

    3/15

    Rational Rose 2002 tutorial

    C:\Documents and Settings\Administrator.WORKSTATION03\Desktop\Rose\RationalRose2002_UML2\RationalRose2002_

    UML.doc

    Page 3 of 15

    With the use case selected, enter the desired name of the use case. (Similar to creating actors above.)

    Create Register for courses, Select courses to teach and Request course roster use cases.

    You may also create documentation for each use case as you did for the actors above.

  • 8/13/2019 Revised Rational Rose2K UML

    4/15

    Rational Rose 2002 tutorial

    C:\Documents and Settings\Administrator.WORKSTATION03\Desktop\Rose\RationalRose2002_UML2\RationalRose2002_

    UML.doc

    Page 4 of 15

    Creating the Main Use Case Diagram:

    Double-click on the Main inthe Use Case View in the browser to open the diagram.

    Click to select an actor in the browser and drag the actor onto the diagram.

    Click to select use case in the browser and drag the use case onto the diagram.Repeat step 2 and 3 for each additional actor and use case needed in the diagram to create the sample given

    below.

    Note: Actors and use cases may also be created directly on a use case diagram by using the toolbar, whichis displayed on the left of the diagram window. Click on the icon and drag it onto the diagram.

    Creating Communicates Associations:

    Click to select the Association icon (straight line) or the Unidirectional Association icon (solid line

    w/arrow) from the diagram toolbar. If the Association icon is not present on the toolbar, it may be added by

    right-clicking on the toolbar, selecting the Customize menu choice from the shortcut menu, and adding the

    icon to the toolbar.

    Click on an actor initiating the communication and drag the association line to the desired use case.

    Complete the example below by drawing the appropriate lines.

    1

    1

  • 8/13/2019 Revised Rational Rose2K UML

    5/15

    Rational Rose 2002 tutorial

    C:\Documents and Settings\Administrator.WORKSTATION03\Desktop\Rose\RationalRose2002_UML2\RationalRose2002_

    UML.doc

    Page 5 of 15

    Classesgroups of objects with State (Attributes) and Behavior (Operations)Creating Classes:

    Right-click to select the Logical View in the browser and Select the New and then select Class in the

    new. A class called New Classis placed in the browser. (Left figure)

    While the new class is still selected, enter the name of the class. (Do not name classes with the same name

    as any of the actors.)Create StudentInformation and ProfessorInformation classes as shown in the browser window. (right

    figure)

    Creating Stereotypes for Classes: (all classes can be classified as Entity, Boundary or Control classes)

    Right-click to select the class in the browser and make the shortcut menu visible.

  • 8/13/2019 Revised Rational Rose2K UML

    6/15

    Rational Rose 2002 tutorial

    C:\Documents and Settings\Administrator.WORKSTATION03\Desktop\Rose\RationalRose2002_UML2\RationalRose2002_

    UML.doc

    Page 6 of 15

    Select the Open Specification menu choice. Select the General tab.

    Enter the name of the stereotype (Entity, Boundary, or Control).

    If you wish, position the cursor in the documentation window and add any comments as to why the class

    will be needed in this design. Good documentation for StudentInformation might be Information needed

    to register and bill students rather than just listing the attributes like name,address, city, etc. Anexplanation of why the class is needed is better than an attribute listing.

    Creating Packages and Relocating Classes to Appropriate Packages:

    Right-click to select the Logical View in the browser and Select the New and then select Packagein the

    new.

    . A New package is placed in thebrowser. (Left figure)

    While the package is still selected, enter the name of the package. Name it PeopleInfo for thisexample.

    Click to select a class in the browser window.

    Drag the class to the desired package in the browser window.

    Repeat the last two steps for each class that is to be relocated.

    Create a package called PeopleInfo and place the classes (StudentInformation and

    ProfessorInformation) in PeopleInfo as shown below.

    2

    2

  • 8/13/2019 Revised Rational Rose2K UML

    7/15

    Rational Rose 2002 tutorial

    C:\Documents and Settings\Administrator.WORKSTATION03\Desktop\Rose\RationalRose2002_UML2\RationalRose2002_

    UML.doc

    Page 7 of 15

    Class DiagramsCreating Welcome (or Main) Class Diagramstypically a picture of all the packages in the system:Double-click on Welcome (or Main) under the Logical Viewin the browser to open a main class diagram.

    Click to select a package in the browser. Click on PeopleInfo for this example.

    Drag the package onto the diagram.

    Repeat for each package. (In this short example, you only have one package, so far)

    Creating a Package Welcome (or Main) Class Diagramone package with all its classes:

    Double-click on the package in the diagram and create/display the Welcome or Main class diagram for thepackage selected. You are using the package PeopleInfo for this example.

    Click to select a class in the browser and drag the class onto the diagram.Repeat the above step for each additional class that is to be placed on the diagram.

    Move StudentInformation and ProfessorInformation classes to the PeopleInfo diagram.

    3

    3

  • 8/13/2019 Revised Rational Rose2K UML

    8/15

    Rational Rose 2002 tutorial

    C:\Documents and Settings\Administrator.WORKSTATION03\Desktop\Rose\RationalRose2002_UML2\RationalRose2002_

    UML.doc

    Page 8 of 15

    Adding Documentation to Each ClassClass Specifications:(Change in option to print the documentation)

    If you did not add documentation to your classes when you created them in the browser, double-click on

    the class icon in the diagram to get the Open Specification screen.

    Place the cursor in the documentation area and enter the text you want.

    Your instructor will probably require class specifications (documentation)on all class

  • 8/13/2019 Revised Rational Rose2K UML

    9/15

    Rational Rose 2002 tutorial

    C:\Documents and Settings\Administrator.WORKSTATION03\Desktop\Rose\RationalRose2002_UML2\RationalRose2002_

    UML.doc

    Page 9 of 15

  • 8/13/2019 Revised Rational Rose2K UML

    10/15

    Rational Rose 2002 tutorial

    C:\Documents and Settings\Administrator.WORKSTATION03\Desktop\Rose\RationalRose2002_UML2\RationalRose2002_

    UML.doc

    Page 10 of 15

    Adding Attributes and Operations to Classes in the Class Diagram:

    Right-click on the class icon in the diagram window, such as StudentInformation, to display the short-cutmenu.

    Choose New Attribute or New Operation, overtype the name of the attribute or operation desired and it willbe added to the class.

    Try adding Name, Address, Major as attributes to StudentInformation, as shown below.

    Try adding PrintStudentInfo as an operation to StudentInformation, as shown below.

    Attributes and operations can also be added to classes in the browser window by right-clicking on the

    selected class to get the short-cut menu. Then choose New:Attribute or New:Operation , as before, and

    overtype a desired name.

  • 8/13/2019 Revised Rational Rose2K UML

    11/15

    Rational Rose 2002 tutorial

    C:\Documents and Settings\Administrator.WORKSTATION03\Desktop\Rose\RationalRose2002_UML2\RationalRose2002_

    UML.doc

    Page 11 of 15

    When you begin to have a lot of classes on a diagram, you may not want to display the attributes and

    operations with each class. You may cancel the display of attributes and operations by right-clicking on the

    class icon, choose Options, and turn-off (click) Show All Attributes and/or Show All operations.

    Relationships

    NOTE: For the following examples, two more Packages need to be created. Create a package called

    UniversityArtifacts with classes of ProfessorCoursemanager, Course and CourseOffering. Crea te another

    package called Interface with classes of ProfessorCourseOptions and AddACourseOffering.

    Notice in the diagram below, the package name is also listed if the classe is external to the current package diagram.

    Creating an Associationa straight line:

    With the Welcome class diagram in the diagram window, click to select the Association icon from the toolbar. Tools>Create>Association

    Click on one of the associated classes in the class diagram.

    Drag the association line to the other associated class, as in Course to AddACourseOffering or

    ProfessorCoursemanager to AddACourseOffering, shown below.

    The dependency icon (dotted line with arrow) can be used to show package relationships on the Main

    package diagram, showing dependencies of one package to another.

    Creating an Aggregationa straight line with a open diamond next to the whole aggregate:

    With the Welcome class diagram in the diagram window, select the Aggregation icon from the toolbar.

    Tools>Create>Aggregate Association

    Click on the class playing the role of the part in a class diagram and drag the line to the class playingthe

    role of the whole, as in Course (whole) and CourseOffering or ProfessorCourseOptions(whole) and

    AddACourseOffering, which is shown in the diagram below.

  • 8/13/2019 Revised Rational Rose2K UML

    12/15

    Rational Rose 2002 tutorial

    C:\Documents and Settings\Administrator.WORKSTATION03\Desktop\Rose\RationalRose2002_UML2\RationalRose2002_

    UML.doc

    Page 12 of 15

    Creating a Generalization (is a )a straight line with an open arrow next to the superclass:

    With the Main class diagram in the diagram window, select the Generalization icon from the toolbar.

    Click on the subclass and drag the generalization line to the superclass, as in FullTimeProfessor to

    ProfessorInformation or PartTimeProfessor to ProfessorInformation in the example below.

  • 8/13/2019 Revised Rational Rose2K UML

    13/15

    Rational Rose 2002 tutorial

    C:\Documents and Settings\Administrator.WORKSTATION03\Desktop\Rose\RationalRose2002_UML2\RationalRose2002_

    UML.doc

    Page 13 of 15

    Naming Relationships:

    Double-click on the line to select the relationship line on the class diagram.

    Enter the name of the line at the cursor, such as manages, pre-requisite and is a in the twoexamples

    above.

    Documenting the Relationship:

    Double-click on the Association, Aggregation or Generalization line you want to document.

    Type your documentation in the Documentation part of the screen displayed.

    Adding Multiplicity to the Association Relationships on the Class Diagram:

    Double-click on the relationship line to make the Specification visible.

    Select the Detail tab.

    Choose a multiplicity for thefrom and to entries from the choices in the pull-down menus.

    Sequence Diagramshows object interactions arranged in time sequence - depicts

    the objects and classes involved in the scenario and the sequence of messages

    exchanged between the objectsassociated with use cases.

    General Information on Sequence Diagrams:

    An object in a sequence diagram can be named as the object (CS1301-Section 1), object and class

    (CS1301-Section 1:CourseOffering) or just the class name with an anonymous object (:CourseOffering).

    Each object will have its timeline represented by a dashed line below the object.

    Messages between objects are represented by arrows pointing from the client (sender of message) to the

    supplier (receiver of the message). Look at the message arrows on the Sequence Diagram below.Creating a Sequence Diagram:

    Right-click on the Use Case View in the browser and make the short-cut menu visible.

    Select the New:Sequence Diagram menu choice. An unnamed sequence diagram is added to the browser.

    With the new sequence diagram selected, enter the name of the sequence diagram. Type SelectACourse.

    Creating Objects and Messages on Sequence Diagram:

    Double-click on the sequence diagram in the browser to open the diagram.

    Click to select an actor in the browser. Select the Student actor from the browser window for this example.

    Drag the actor onto the sequence diagram as shown in the sample below.

    Click to select an object icon from the toolbar (oval box) and drag it to the Sequence Diagram.

    While the object is still selected, enter the name of the object. (Class name can be easily added later see

    below.) Type CourseListing in the object box.

    Repeat above steps for each object and actor in the scenario. (Add two more objects for this example.)

    Click to select the object message icon from the toolbar (arrow).

    Click on the actor or object sending the message and drag the message line to the actor or object receiving

    the message.

    While the message line is still selected, enter the name of the message.Repeat these last 3 steps for each message needed. Complete the sample Sequence Diagram below by

    adding four message lines.

    Assigning Objects in a Sequence Diagram to Classes:

    Click to select the class in the browser.

    Drag the class onto the object in the sequence diagram. Rational Rose will add :classname to the object. If

    the object is unnamed, just :classname will appear in box. (Class names are not added in this example.)

  • 8/13/2019 Revised Rational Rose2K UML

    14/15

    Rational Rose 2002 tutorial

    C:\Documents and Settings\Administrator.WORKSTATION03\Desktop\Rose\RationalRose2002_UML2\RationalRose2002_

    UML.doc

    Page 14 of 15

    State Transition Diagramshows the states of a single object of a class, the events

    or messages that cause a transition from one state to another, and the actions that

    result from a state changeconcentrate on the what of the problem, not the how ofthe solution.

    Creating state chart diagrams:

    Right-click to select a class in the browser window and make the short-cut menu visible. Right click on

    CourseOffering under UniversityArtifacts as shown in the browser window, which is shown below. If

    you cannot see CourseOffering in your browser window, click on the + next toUniversityArtifacts to

    display all of its classes.

    Right click on Course Offering > New> State Chart Diagram.

    To open the diagram at another time, click the + to expand the class in the browser, and double-click on its

    state transition diagram in the browser.

    Using the toolbar provided, click on the state (rounded rectangle), transition (line with arrow), start (solid-filled circle) and stop (partly-filled circle) icons and place on diagram in positions needed. For a change to

    the same state, draw the line in 2 segments - drag out to a point, click, and then drag back to the state (as inAdd a Student, shown below).

    The first two symbols can be named while they are selected. There is no cursor visible just type and thetext will appear on the state rectangle or the transition line.

    Complete the example as shown below.

  • 8/13/2019 Revised Rational Rose2K UML

    15/15

    Rational Rose 2002 tutorial

    C:\Documents and Settings\Administrator.WORKSTATION03\Desktop\Rose\RationalRose2002_UML2\RationalRose2002_

    UML.doc

    Page 15 of 15

    Save/Print the diagrams you have createdclick on File and choose Save/Print from the pull-

    down menu. You can choose to print diagrams or specifications.

    Error CheckingSelect a package by double-clicking on it in the Main diagram, such as PeopleInfoMain.

    Open the Tools Menu at the top of the screen and select Check Model

    If you made any errors during the modeling, a small window will pop up and say, There are errors. See

    log file for details.

    To see the log, click on the Log window at the bottom of the diagram window.

    Note: our sample is not complete so there will be errors.