62
Introduction to Rational Rose 98i v 5.2 Copyright 1993-1999 Rational Software, all rights reserved 1 Introduction to Rational Rose 98i Module 4: Class Diagram

04class

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 1

Introduction to Rational Rose 98i

Module 4: Class Diagram

Page 2: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 2

Objectives: Class Diagram

You will be able to: Create classes Add attributes and operations to classes Create stereotypes for classes Create packages Relocate classes Create class diagrams Create relationships

Page 3: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 3

Classes in the Browser

Page 4: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 4

Namespaces

Page 5: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 5

Documenting Classes

Page 6: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 6

Using the Class Specification - Stereotypes

Page 7: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 7

Using the Class Specification - Attributes

Page 8: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 8

Using the Class Specification - Operations

Page 9: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 9

Attributes and Operations and the Browser

Page 10: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 10

Attribute Visibility Options

NewClassPublic attributeProtected attributePrivate attribute

NewClass+ Public attribute# Protected attribute- Private attribute

Page 11: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 11

Operation Visibility Options

NewClass

Public operation()Protected operation()Private operation()

NewClass

+ Public operation()# Protected operation()- Private operation()

Page 12: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 12

Packages in the Browser

Page 13: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 13

Moving Classes to Packages

Page 14: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 14

What is a Class Diagram?

A class diagram is a view of the static structure of a system Models contain many class diagrams

Class diagrams contain: Packages, classes, interfaces, and

relationships Notation:

Package Name

Class NameInterface Name

<<Interface>>

Page 15: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 15

The Main Class Diagram

The logical view initially contains one class diagram This diagram is called Main

The Main class diagram is typically a view of the high level packages in the logical view

Page 16: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 16

Class Diagram Drawing Toolbar

Text

Attachment

Association Relationship

Association Attribute

Dependency Relationship

Inherits Relationship

Package

Selection Tool

Note

Class

Aggregation Relationship

Interface

Realizes Relationship

Page 17: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 17

Main Class Diagram-Registration System

Page 18: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 18

Main Diagram Business Services Package

Page 19: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 19

Creating Classes on a Class Diagram

Page 20: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 20

Class Name Completion

Page 21: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 21

Creating Attributes via a Class Diagram

Page 22: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 22

Creating Operations via a Class Diagram

Page 23: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 23

Additional Class Diagrams

Additional class diagrams are added as needed

They show additional “views” of the packages and classes in the model

Examples: View of classes participating in a scenario View of the “private” classes in the package View of one or more classes and their

attributes and operations View of an inheritance hierarchy

Page 24: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 24

Additional Class Diagram

Page 25: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 25

Showing Stereotypes

Page 26: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 26

Color

Page 27: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 27

Displaying Attributes and Operations

Page 28: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 28

Displaying the Operation Signature

Page 29: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 29

Displaying Visibility

Page 30: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 30

Relationships

Class diagrams may contain the following relationships: Association, aggregation, dependency, realize,

and inheritance Notation:

Association Aggregation Dependency

Inheritance Realize

Page 31: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 31

Package Relationships

Page 32: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 32

Class Relationships

Page 33: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 33

Navigation

Unidirectional

Bi-directional

Page 34: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 34

Associations / Aggregations in the Browser

Navigable

Not Navigable

Page 35: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 35

Naming Associations

Page 36: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 36

Role Names

Page 37: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 37

Zero or more0..*

One or more1..*

Zero or one0..1

Specified range2..7

Exactly one1

Multiplicity Indicators

Each end of an association or aggregation contains a multiplicity indicator Indicates the number of objects participating in

the relationship

Page 38: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 38

Multiplicity Indicators

Page 39: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 39

Aggregation Indicators

Page 40: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 40

Reflexive Relationships

Page 41: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 41

Constraints

Page 42: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 42

Qualifiers

Page 43: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 43

Association Classes

Page 44: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 44

Deleting

If a package, class, association, or aggregation is deleted from the Browser then it is deleted from the model

If a package, class, association, or aggregation is deleted from a Class Diagram, it is deleted from the diagram but still remains in the model

Page 45: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 45

Exercise: Classes

Use the pictures on the following pages to create the packages, classes, and class diagrams for your model

Page 46: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 46

Exercise: Classes in the Browser

Page 47: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 47

Exercise: Documenting Classes

Page 48: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 48

Exercise: Stereotypes

Page 49: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 49

Exercise: Packages in the Browser

Page 50: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 50

Exercise: Relocating Classes

Page 51: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 51

Exercise: Creating Attributes

Page 52: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 52

Exercise: Creating Operations

Page 53: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 53

Exercise: The Main Class Diagram

Page 54: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 54

Exercise: Package Main Class Diagram

Page 55: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 55

Exercise: Additional Class Diagram

Page 56: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 56

Exercise: Displaying Attributes/Operations

Page 57: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 57

Exercise: Relationships

Page 58: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 58

Exercise: Relationships

Page 59: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 59

Exercise: Reflexive Relationships

Page 60: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 60

Exercise: Role Names

Page 61: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 61

Exercise: Multiplicity

Page 62: 04class

Introduction to Rational Rose 98i v 5.2Copyright 1993-1999 Rational Software, all rights reserved 62

Exercise: Constraints