intro to uml

38
EEL5881 Software Engineering I UML Lecture

Upload: master

Post on 06-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 1/38

Page 2: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 2/38

Slides materialSlides material are taken from different sources

including:

UML resource page http://www.uml.org Google: UML Tutorial/Diagrams

Object-Oriented Classical Software Engineering,

seventh Edition, Stephen R. Schach

the slides of Mr. Shiyuan Jin¶s UML class, EEL4884, Fall 2003

the slides of Mr. Yi Luo¶s UML class, EEL 5881, Fall

2007.

Page 3: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 3/38

Outline

What is UML?

Why Use UML?

UML Diagrams

Resources

Page 4: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 4/38

What is UML?

UML ³Unified Modeling Language´

Unified: UML has become a world

standard

Modeling :Describing a software system

at a high level of abstraction

Language: More comprehensible, ready-to-use, expressive, and visualing.

Page 5: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 5/38

What is UML? Goals of UML:

Provide extensibility and specialization mechanisms to

extend the core concepts Be independent of particular programming languages and

development processes

Provide a formal basis for understanding the modeling

language

Encourage the growth of the OO tools market. Support higher-level development concepts such as

collaborations, frameworks, patterns and components.

Page 6: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 6/38

What is UML?

History of UML

Object-Oriented modeling languages

began to appear between mid-1970 and

the late 1980s ;

Identified modeling languages: < 10 >

50 (1989-1994 ) Necessity and development

Page 7: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 7/38

What is UML?

1997: UML 1.0, 1.1

1996: UML 0.9 & 0.91

1995: Unified Method 0.8

Other methods

Booch µ91

Booch µ93 OMT - 2

OMT - 1

Year Version2003: UML 2.0

2001: UML 1.4

1999: UML 1.3

began in late 1994(unifying the Booch and OMT

(Object Modeling Technique) methods )

Page 8: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 8/38

UML Diagrams Each UML diagram is designed to let developers

and customers view a software system from a

different perspective and in varying degrees of abstraction

Use Case Diagram

Class Diagram

Interaction Diagrams (Sequence Diagram / Collaboration

Diagram ) State Diagram

 Activity Diagram

«

Page 9: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 9/38

Use-Case Diagrams Relationship between actors and use cases;

capturing user requirements.

Actors: An actor is represents a user or another system that will interact with the system you are

modeling

Use cases: an external view of the system that

represents some actions the user might perform in

order to complete a task

Page 10: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 10/38

Use-Case Diagrams When to use:

Use cases are used in almost every project.

How to Draw Simplest

Page 11: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 11/38

Use-Case Diagrams: Example

A user placing an order with a sales

company might follow these steps : Browse catalog and select items.

Call sales representative.

Supply shipping information.

Supply payment information.

Receive conformation number from salesperson.

Page 12: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 12/38

Use-Case Diagrams: Example

The salesperson

could also be included

in this use casediagram because the

salesperson is also

interacting with the

ordering system.

Page 13: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 13/38

Use-Case Diagrams Relationships in Use Cases

Include: a use case includes the

functionality described in another usecase. (directed arrow having a dotted shaft,

labeled <<include>> )<<include>>

Page 14: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 14/38

Use-Case Diagrams Extend: the child use case, the parents use

case.

<<extend>>

The "Perform Pathological Tests" use case

is a specialized version of the generic

"Perform medical tests" use case.

Page 15: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 15/38

Use-Case Diagrams Generalizations: The child use case in the

generalization relationship has the

underlying business process meaning, but isan enhancement of the parent use case.

(directed arrow with a triangle arrowhead )

you can replace any occurrence of the "Store patient records (paper file)"

use case in the business flow of your 

system with the "Store patient records

(computerized file)" use case without

impacting any business flow.

Page 16: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 16/38

Class diagram Class diagrams are widely used to describe

the types of objects in a system and their 

relationships Each class is represented by a rectangle

subdivided into three compartments Name

Attributes

Operations

Page 17: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 17/38

Page 18: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 18/38

Class diagram

There are two kinds of Relationships      Generalization (parent-child relationship)

      Association (student enrolls in course)

Associations can be further classified

as      Aggregation

      Composition

Page 19: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 19/38

Generalization

Subtype2

Super type

Subtype1

-Inheritance is a required feature of object orientation

-Generalization expresses a parent/child relationship among related classes.

-Used for abstracting details in several layers

Regular 

Customer 

Loyalty

Customer 

Customer Exam ple:

Page 20: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 20/38

 Association

Associations represent static

relationships between classes. (association names filled arrow )

(Place roles near the end of an association)

Page 21: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 21/38

 Association: Multiplicity and Roles

University Person

1

0..1

*

*

Multiplicity

Symbol Meaning

1 One and only one0..1 Zero or one

M..N From M to N (natural language)

* From zero to any positive integer  

0..* From zero to any positive integer  

1..* From one to any positive integer  

teacher employer 

R ole

Role

³A given university groups many people;

some act as students, others as teachers.

 A given student belongs to a single

university; a given teacher may or may not 

be working for the university at a particular 

time.´ 

student

Page 22: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 22/38

 Association

: Composition and  Aggregation

Association: Models the part±whole relationship

Composition : (filled diamond)

³Every part may belong to only one whole, and If the

whole is deleted, so are the parts´ 

Aggregation : (hollow diamond).

³ It is a specific kind of Container-Containee

relationship´ 

Page 23: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 23/38

 A

ggregation vs. Composition

Composition is really a strong form of association components have only one owner 

components cannot exist independent of their owner 

components live or die with their owner 

e.g. Each car has an engine that can not be shared withother cars.

Aggregations may form "part of" the association, but may not be

essential to it. They may also exist independent of theaggregate. e.g. Employees may exist independent of theteam.

Page 24: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 24/38

 A

ssociation: Composition and  Aggregation

Composition : (filled diamond)

 Aggregation : (hollow diamond).

Page 25: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 25/38

Interaction Diagrams

Interaction diagrams are used when you want to model the

behavior of several objects in a use case

UML supports two types of interaction diagrams

      Sequence diagramsSequence diagrams generally show the sequence of events that occur 

      Collaboration diagrams

Collaboration diagrams demonstrate how objects are statically connected.

Page 26: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 26/38

Sequence Diagram:Object interaction

 Self  Self--Call Call : A message that an

O bject sends to itself.

Condition: indicates when a

message is sent. The message is

sent only if  the condition is tr ue.

Iteration

Condition

 A B

Synchronous

 Asynchronous

Transmission

delayed

Self-Call

[condition] remove()

*[f or each] remove()

Page 27: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 27/38

Sequence Diagram(make a phone call)

Caller  Phone Recipient

Picks up

Dial tone

Dial

Ring notification Ring

Picks up

Hello

Page 28: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 28/38

Sequence Diagrams  Object Life Spans

Creation

Create message

Object life starts at that point

Activation Symbolized by rectangular 

stripes

Place on the lifeline where object

is activated.

Rectangle also denotes whenobject is deactivated.

Deletion

Placing an µX¶ on lifeline

Object¶s life ends at that point

Activation  bar 

A

B

Create

X

DeletionReturn

Lif eline

Page 29: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 29/38

Sequence Diagrams  Object Life Spans

Page 30: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 30/38

Interaction Diagrams: Collaboration diagrams

User 

Catalog

Reservations

start

1: look up2: title data

3 : [not available] reserve title

4 : title returned

5 : hold title

6 : borrow title

6: remove reservation

5: title available

     Collaboration diagrams are equivalent to sequence diagrams.  All the features of sequencediagrams are equally applicable to collaboration diagrams

     Use a sequence diagram when the transfer of information is the focus of attention

     Use a collaboration diagram when concentrating on the classes

Page 31: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 31/38

State Diagrams (Billing Example)

State Diagrams show the sequences of states an o bject 

goes through during its lif e cycle in res ponse to

stimulin, together with its res ponses and actions;

an a bstraction of all  possi ble behaviors.

Un paid

Star t End

PaidInvoice created paying Invoice destroying

Page 32: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 32/38

Yellow

Red

Green

Traffic Light

State

Transition

Event

Star t

State Diagrams (Traffic light example)

Page 33: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 33/38

 Activity Diagrams

Activity diagrams describe the

workflow behavior of a system.

similar to state diagrams because

activities are the state of doing something

Activity diagrams can show activitiesthat are conditional or parallel.

Page 34: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 34/38

 Activity Diagram: Elements

34

Rounded rectangle

represents activity or action

Example

Solid circle

Represents start of the

workflow

Example

Diamond

represents decision

Example

Dotted circlerepresents end of the

workflow

Example

Bar represents start

or end of concurrent

activities/actions

Customer orders drink

First  Action to do

Customer 

orders drink

Make sure Customer is

at least 21 years old

Get drink for 

Customer 

[Drink is

alcoholic]

[else]

Last  Action to do

Page 35: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 35/38

 Activity Diagrams

Page 36: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 36/38

Conclusion

UML is a standardized specification language for objectmodeling

Several UML diagrams: Use-case diagram: a number of use cases (use case models the

interaction between actors and software) Class diagram: a model of classes showing the static

relationships among them including association andgeneralization.

Sequence diagram: shows the way objects interact with oneanother as messages are passed between them. Dynamic model

State diagram: shows states, events that cause transitions

between states.  Another dynamic model reflecting the behavior of objects and how they react to specific event

 Activity diagram: describes the state of activities by showing thesequence of activities performed.

Page 37: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 37/38

UML Resources

Books Martin Fowler, Kendall Scott: UML Distilled ,  Addison-Wesley

2000

Grady Booch, et al: T he U nified M odeling Language U ser 

Guide,  Addison-Wesley James Rumbaugh, et al: T he U nified M odeling Language

Reference M anual, Addison-Wesley Ivar Jacobson, et al:U nified Software Development Process, Addison-Wesley

Online UML Resources Rational Software ±

UML Resource Center (http://www.rational.com/uml/index.jsp),

UML Quick Reference(http://www.rational.com/uml/resources/quick/index.jsp),UML Whitepapers(http://www.rational.com/uml/resources/whitepapers/index.jsp)Recommended Books(http://www.rational.com/uml/reading/index.jsp)UML Cafe(http://cafe.rational.com/HyperNews/get/hn/umlcafe.html)

Page 38: Intro to UML

8/3/2019 Intro to UML

http://slidepdf.com/reader/full/intro-to-uml 38/38

UML Resources

T he Object M anagement Group -- UML resource Page(http://www.omg.org/technology/uml/index.htm), UML Tutorial(http://cgi.omg.org/news/pr97/umlprimer.html)

T he UML Center -- UML Information

(http://atlas.kennesaw.edu/~dbraun/csis4650/ A

&D/UML_tutorial/r esources.htm#1)UML Events(http://atlas.kennesaw.edu/~dbraun/csis4650/ A&D/UML_tutorial/r esources.htm#evnts)

T he UML Zone -- UML F AQ(http://www.uml-zone.com/umlfaq.asp)UML Q& A 

(http://news.devx.com/cgi-bin/dnewsweb.exe?utag=&group=vb.oop&xrelated=8577&cmd_r elated.x=69&cmd_related.y=6)

GDpro -- UML Center (http://www.gdpro.com/uml_central.html)UML Dictionary(http://softdocwiz.com/UML.htm)