uml introduction

18
2000-05-09 Improved software quality through semantic descriptions (Skutt) Karlstad University Dept. of Computer Science UML introduction A short introduction to UML Eivind J. Nordby Karlstad University

Upload: medge-underwood

Post on 31-Dec-2015

14 views

Category:

Documents


0 download

DESCRIPTION

UML introduction. A short introduction to UML Eivind J. Nordby Karlstad University. Design Problem. Complex systems cannot be understood without modelling Modelling makes design reproductable Modelling is documentation => Generic Language for this Problem Unified Modeling Language (UML) - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: UML introduction

2000-05-09 Improved software quality through semantic descriptions (Skutt)

Karlstad UniversityDept. of Computer Science

UML introduction

A short introduction to UML

Eivind J. Nordby

Karlstad University

Page 2: UML introduction

Semla 2 page 2Karlstad UniversityDept. of Computer Science

Design Problem

• Complex systems cannot be understood without modelling• Modelling makes design reproductable• Modelling is documentation

• => Generic Language for this ProblemUnified Modeling Language (UML)

• Standard of the OMG• Current Version 1.4 (since Sep. 2001)• Inventors: Jacobson, Rumbaugh, Booch.

• Goal: Giving developer a general language for communication

Page 3: UML introduction

Semla 2 page 3Karlstad UniversityDept. of Computer Science

UML

• UML is a graphical language

– Unified Modeling Language

• UML provides a notation to describe software-intensive systems in an object-oriented way

– Is general enough to describe nonsoftware systems

• Static Modelling– Class Modelling– Component Modelling– Deployment Modelling

• Dynamic Modelling– Activity/Sequence Modelling– Use Case Modelling– State Modelling

Page 4: UML introduction

Semla 2 page 4Karlstad UniversityDept. of Computer Science

An example

• A booking system for room reservation

• The initiator tell who shall take part in the meeting

• The system calls the participants by email

• The participants reply confirm by email

• When all have confirmed, the system sends an email to the initiator

– Support personnel are also notified

• Cleaning, catering, secretaries, caretaker

Page 5: UML introduction

2000-05-09 Improved software quality through semantic descriptions (Skutt)

Karlstad UniversityDept. of Computer Science

Part 1

Classes and objects

Static description

Page 6: UML introduction

Semla 2 page 6Karlstad UniversityDept. of Computer Science

Basic class description

• A class is drawn as a box with compartments for

– class name– attributes– operations

• Any but the first can be empty or suppressed

Booking

addParticipant()confi rm()cancel()

Booking

Note

Booking

timeconfirmed

addParticipant()confirm()cancel()

Class name

Attributes

Operations

Page 7: UML introduction

Semla 2 page 7Karlstad UniversityDept. of Computer Science

Inheritance

• Inheritance

– A connection with an open triangle in the direction to the base class

• Abstract classes and operations

– Italic class name

– Italic operation name

Booking

addParticipant()confirm()cancel()

Single Booking

Repeated Booking

Page 8: UML introduction

Semla 2 page 8Karlstad UniversityDept. of Computer Science

Associations

• Analysis diagram

• Multiplicities

– 0..1, 1, *, 1..*

Room

Initiator

ParticipantEquipment

SupportService

Booking

addParticipant()confirm()cancel()

***

1*

1

*

*

*

*

Page 9: UML introduction

Semla 2 page 9Karlstad UniversityDept. of Computer Science

Associations

• Association label

– a verb describing the interaction

• Interpretation of multiplicity

• Referencial integrity

Politician

Lie

timeaudience

1..* *1..*

is told by

*

Husband Lady

10..1 10..1

Booking

Initiator

1

*

1

*

Page 10: UML introduction

Semla 2 page 10Karlstad UniversityDept. of Computer Science

Object diagram and links

• Class diagrams show the general structure with

• Object diagrams show snapshots

– objects are underlined

Jakob : Initiator

Stefan : Participant

Martin : Participant

Hua : Participant

: Single Booking

: FlipOver

: OHProjector

: OHProjector

Röd hörsal

• An association is a potential for a link

• links are instances of associations• Links do never have multilplicities

Page 11: UML introduction

Semla 2 page 11Karlstad UniversityDept. of Computer Science

Role names

• Role label

– a noun describing the role in the interaction

WomanMan

is married to

manages

husbandwife

clerkmanager

Employed

1*

Manager

Subordinate

1*

Page 12: UML introduction

Semla 2 page 12Karlstad UniversityDept. of Computer Science

Aggregations

• Aggregation

– a crew is composed of crew members

– expresses whole - parts

• Composition

– a person owns a PID number

– expresses exclusive ownership and dependency

Manager Crewmanages

Crew Member

**

PersonPIDNumber

Page 13: UML introduction

Semla 2 page 13Karlstad UniversityDept. of Computer Science

Navigability

• Analysis expresses relationships

• Design diagram also expresses navigability

– Part of the implementation design of “who keeps track of who”

*

Booking

addParticipant()confirm()cancel()*

**

1*

1Initiator

*

*ParticipantEquipment

* Room

SupportService

Page 14: UML introduction

2000-05-09 Improved software quality through semantic descriptions (Skutt)

Karlstad UniversityDept. of Computer Science

Part 2

Interactions

Dynamic description

Page 15: UML introduction

Semla 2 page 15Karlstad UniversityDept. of Computer Science

: Initiator : Booking : ParticipantBookingDialog

displayTimes

selectRoomnew(room)

[while more] addParticipant

call

Interactions

Page 16: UML introduction

Semla 2 page 16Karlstad UniversityDept. of Computer Science

reservation

Reservation

room

Room TimelineView

:Reserver

/getName

/getRoomName

/getTime

/displayTimeLine

*[reservation.moreIterations()]loop/collectReservationInfo

Interactions

Page 17: UML introduction

Semla 2 page 17Karlstad UniversityDept. of Computer Science

Interactions

• Sequence diagram– Time based

• Life line• Call, operation, return• Activation record• Recursive calls• New and delete

Page 18: UML introduction

Semla 2 page 18Karlstad UniversityDept. of Computer Science

Interactions, new and delete

:Reserver

ReservationDialog

new

Reservation

calling

EMail

Participant

/selectParticipants

/selectRoom

/selectTimeSlice

/notify

/<constructor>

dispose

*[all Participants]/notify

/setText

/<constructor>