Eel4884 Esd Spr05 Uml
Transcript of Eel4884 Esd Spr05 Uml
-
7/25/2019 Eel4884 Esd Spr05 Uml
1/38
Introduction to UMLIntroduction to UML
Majid Ali KhanMajid Ali Khan
Spring 2005Spring 2005
-
7/25/2019 Eel4884 Esd Spr05 Uml
2/38
AcknowledgementsAcknowledgements
Slides material are taken fromSlides material are taken fromdierent sources including!dierent sources including! "rashanth Aedunuthula UML"rashanth Aedunuthula UML
presentation# $all 200%presentation# $all 200% Lecture slides from Software &ngineeringLecture slides from Software &ngineering
course at U' (erkele) *"rofessor +eculacourse at U' (erkele) *"rofessor +ecula
, $all 200%-, $all 200%- Lecture slides from a course on we. at!Lecture slides from a course on we. at!
www/sts/tuhar.urg/de1 teaching1wswww/sts/tuhar.urg/de1 teaching1ws3/144A6170UML/pdf3/144A6170UML/pdf
-
7/25/2019 Eel4884 Esd Spr05 Uml
3/38
48er8iew48er8iew
9hat is Modeling:9hat is Modeling:
9hat is UML:9hat is UML:
A .rief histor) of UMLA .rief histor) of UML Understanding the .asics of UMLUnderstanding the .asics of UML
UML diagramsUML diagrams
UML Modeling toolsUML Modeling tools
-
7/25/2019 Eel4884 Esd Spr05 Uml
4/38
ModelingModeling
6escri.ing a s)stem at a high le8el of6escri.ing a s)stem at a high le8el of
a.stractiona.straction A model of the s)stemA model of the s)stem Used for re;uirements and speci
-
7/25/2019 Eel4884 Esd Spr05 Uml
5/38
4.ject 4riented Modeling4.ject 4riented Modeling
-
7/25/2019 Eel4884 Esd Spr05 Uml
6/38
9hat is UML:9hat is UML:
UML stands for Unified Modeling LanguageUML stands for Unified Modeling Language
It is a industry-standard graphical language forIt is a industry-standard graphical language for
specifying, visualizing, constructing, andspecifying, visualizing, constructing, anddocumenting the artifacts of software systemsdocumenting the artifacts of software systems
The UML uses mostly graphical notations toThe UML uses mostly graphical notations toepress the !! analysis and design of softwareepress the !! analysis and design of softwarepro"ects#pro"ects#
$implifies the comple process of software design$implifies the comple process of software design
-
7/25/2019 Eel4884 Esd Spr05 Uml
7/38
9h) UML for Modeling9h) UML for Modeling
Use graphical notation to communicate moreUse graphical notation to communicate more
clearl) than natural language *imprecise- andclearl) than natural language *imprecise- and
code*too detailed-/code*too detailed-/
=elp ac;uire an o8erall 8iew of a s)stem/=elp ac;uire an o8erall 8iew of a s)stem/
UML isUML is notnot dependent on an) one language ordependent on an) one language or
technolog)/technolog)/
UML mo8es us from fragmentationUML mo8es us from fragmentationtoto
standardi>ationstandardi>ation..
-
7/25/2019 Eel4884 Esd Spr05 Uml
8/38
=istor) of UML=istor) of UML
-
7/25/2019 Eel4884 Esd Spr05 Uml
9/38
Types of UML %iagramsTypes of UML %iagrams
Use Case DiagramUse Case Diagram
Class DiagramClass Diagram
Sequence DiagramSequence Diagram
Collaboration DiagramCollaboration Diagram
State DiagramState Diagram
This is only a su&set of diagrams ' &ut are mostThis is only a su&set of diagrams ' &ut are mostwidely usedwidely used
-
7/25/2019 Eel4884 Esd Spr05 Uml
10/38
Use 'ase 6iagramUse 'ase 6iagram
Used for descri.ing a set of user
scenarios
Mainl) used for capturing userre;uirements
9ork like a contract.etween end
user and software de8elopers
-
7/25/2019 Eel4884 Esd Spr05 Uml
11/38
Use Case Diagram (core components)
Actors: A role that a user plays with respect to the system,includinghuman users and other systems. e.g.,inanimate physical objects (e.g. robot);
an external system that needs some information from the current system.
Use case:A set of scenarios that describing an interaction between a userand a system, including alternatives#
System boundary: rectangle diagram representing the boundarybetween the actors and the system.
-
7/25/2019 Eel4884 Esd Spr05 Uml
12/38
Use Case Diagram(core relationship)
Association: communication between an actor and
a use case; epresented by a solid line.
!enerali"ation: relationship between one general
use case and a special use case (used for defining
special alternatives)
epresented by a line with a triangular arrow headtoward the parent use case.
-
7/25/2019 Eel4884 Esd Spr05 Uml
13/38
Use Case Diagram(core relationship)
#xtend: a dotted line labeled $$extend%% with an arrowtoward the base case.&he extending use case may add behavior tothe base use case. &he base class declares 'extension points.
$$extend%%
nclude: a dotted line labeled $$include%% beginning at baseuse case and ending with an arrows pointing to the include
use case. &he include relationship occurs when a chun* of
behavior is similar across more than one use case. +se
'include in stead of copying the description of that behavior.
$$include%%
-
7/25/2019 Eel4884 Esd Spr05 Uml
14/38
Use Case DiagramsUse Case Diagrams
Li&rary $ystem
(orrow
!rder Title
)ine *emittance
+lient mployee
$upervisor
A generali"ed description of how a system will be used.
-rovides an overview of the intended functionality of the system
Boundary
ActorUse Case
-
7/25/2019 Eel4884 Esd Spr05 Uml
15/38
Use Case DiagramsUse Case Diagrams(cont.)(cont.)
(TogetherSoft, Inc)
-
7/25/2019 Eel4884 Esd Spr05 Uml
16/38
Use Case DiagramsUse Case Diagrams(cont.)(cont.)
Pay Billis a parent use case and Bill Insuranceis the
child use case. (generali"ation)
oth Make Appointmentand Request Medication
include Check Patient Recordas a subtas*.(include)
&he extension point is written inside the base case
Pay bill; the extending class e!er paymentadds thebehavior of this extension point. (extend)
-
7/25/2019 Eel4884 Esd Spr05 Uml
17/38
'lass diagram'lass diagram
Used for descri.ingUsed for descri.ing structure andstructure and.eha8ior.eha8iorin the use casesin the use cases
"ro8ide a conceptual model of the"ro8ide a conceptual model of thes)stem in terms of entities and theirs)stem in terms of entities and theirrelationshipsrelationships
Used for re;uirement capture# enduserUsed for re;uirement capture# enduser
interactioninteraction 6etailed class diagrams are used for6etailed class diagrams are used for
de8elopersde8elopers
-
7/25/2019 Eel4884 Esd Spr05 Uml
18/38
'lass representation'lass representation
&ach class is represented .) a rectangle su.di8ided into&ach class is represented .) a rectangle su.di8ided intothree compartmentsthree compartments +ame+ame Attri.utesAttri.utes 4perations4perations
Modi
-
7/25/2019 Eel4884 Esd Spr05 Uml
19/38
An example of ClassAn example of Class
ccount./ame
- +ustomer./ame- (alance
0add)unds1 2
0with%raw1 2
0transfer1 2
/ame
ttri&utes
!perations
-
7/25/2019 Eel4884 Esd Spr05 Uml
20/38
// elationships
Bhere are two kinds of CelationshipsBhere are two kinds of Celationships Denerali>ation *parentchild relationship-Denerali>ation *parentchild relationship-
Association *student enrolls in course-Association *student enrolls in course-
Associations can .e further classi
-
7/25/2019 Eel4884 Esd Spr05 Uml
21/38
0ubtype1
0upertype
0ubtype2
// elationships:"enerali#ation
3 !enerali"ation expresses a
parent4child relationship among related
classes.
3 +sed for abstracting details in several
layers
egular
5ustomer
6oyalty
5ustomer
5ustomer#xample:
egular
5ustomer
6oyalty
5ustomer
5ustomeror:
-
7/25/2019 Eel4884 Esd Spr05 Uml
22/38
Cepresent relationship .etweenCepresent relationship .etweeninstances of classesinstances of classes Student enrolls in a courseStudent enrolls in a course
'ourses ha8e students'ourses ha8e students
'ourses ha8e eEams'ourses ha8e eEams
&tc/&tc/
Association has two endsAssociation has two ends Cole names *e/g/ enrolls-Cole names *e/g/ enrolls- Multiplicit) *e/g/ 4ne course can ha8e man)Multiplicit) *e/g/ 4ne course can ha8e man)
students-students-
+a8iga.ilit) *unidirectional# .idirectional-+a8iga.ilit) *unidirectional# .idirectional-
// elationships: Association
-
7/25/2019 Eel4884 Esd Spr05 Uml
23/38
Association! Multiplicit) and ColesAssociation! Multiplicit) and Coles
University 3erson
4
5##4
6
6
Multiplicity
$ym&ol Meaning
4 !ne and only one
5##4 7ero or one
M##/ )rom M to / 1natural language2
6 )rom zero to any positive integer
5##6 )rom zero to any positive integer
4##6 )rom one to any positive integer
teacheremployer
Role
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 or the university at a particular
time.!
student
-
7/25/2019 Eel4884 Esd Spr05 Uml
24/38
Class DiagramClass Diagram
!rder
-date*eceived
-is3repaid
-num&er 8$tring-price 8 Money
0dispatch12
0close12
+ustomer
-name
-address
0credit*ating12 8 $tring12
+orporate +ustomer
-contact/ame
-credit*ating
-creditLimit
0remind12
0&ill)orMonth1Integer2
3ersonal +ustomer
-credit+ard9
!rderLine
-:uantity8 Integer
-price8 Money
-is$atisfied8 (oolean
3roduct6 4
4
6mployee
6
;if !rder#customer#credit*ating is
-
7/25/2019 Eel4884 Esd Spr05 Uml
25/38
Association! Model to ImplementationAssociation! Model to Implementation
'lass Student F'lass Student F
'ourse enrollsG%H'ourse enrollsG%H
JJ
'lass 'ourse F'lass 'ourse F
Student ha8eGHStudent ha8eGH
JJ
Student 'ourseenrollshas
%
-
7/25/2019 Eel4884 Esd Spr05 Uml
26/38
// elationships:Composition
Class $
ClassP% ClassP&
Composition: expresses a relationship amon' instances
o! related classes( It is a speci!ic kind o! $hole)Part
relationship(
It expresses a relationship *here an instance o! the
$hole)class has the responsibility to create and initiali#e
instanceso! each Part)class(
It may also be used to express a relationship *here instances
o! the Part)classes ha+e pri+ile'ed access or +isibilityto
certain attributes and,or beha+iors de!ined by the$hole)class(
Composition should also be used to express relationship *here
instances o! the $hole)class ha+e exclusi+e access to and
control o! instances o! the Part)classes(
Composition should be used to express a relationship *here
the beha+ior o! Part instances is unde!ined *ithout bein'
related to an instance o! the $hole( And- con+ersely- the
beha+ior o! the $hole is ill)de!ined or incomplete i! one or
more o! the Part instances are unde!ined(
$hole Class
Part Classes
Automobile
.n'ine /ransmission
.xample
rom ?r.?avid A. @or*man=
-
7/25/2019 Eel4884 Esd Spr05 Uml
27/38
// elationships: A''re'ation
ClassC
Class .% Class .&
A""R."A/I01
A''re'ation: expresses a relationship amon' instanceso! related classes( It is a speci!ic kind o! Container)
Containee
relationship(
It expresses a relationship *here an instance o! the
Container)class has the responsibility to hold and
maintaininstanceso! each Containee)class that ha+e been created
outside the auspices o! the Container)class(
A''re'ation should be used to express a more in!ormal
relationship than composition expresses( /hat is- it is an
appropriate relationship *here the Container and its
Containeescan be manipulated independently(
A''re'ation is appropriate *hen Container and
Containeesha+e no special access pri+ile'es to each other(
Container Class
Containee Classes
Ba'
Apples Milk
.xample
rom ?r.?avid A. @or*man=
-
7/25/2019 Eel4884 Esd Spr05 Uml
28/38
Aggregation vs. CompositionAggregation vs. Composition
CompositionCompositionis really a strong form of a''re'ationcomponents have only one ownercomponents cannot exist independent of their owner
components live or die with their ownere.g. #ach car has an engine that can not be shared with
other cars.
A''re'ationsmay form part of the aggregate, but may not
be essential to it. &hey may also exist independent of the
aggregate.
e.g. Apples may exist independent of the bag.
-
7/25/2019 Eel4884 Esd Spr05 Uml
29/38
Class
eservations
Responsibility
Beep list of reserved titles
Candle reservation
Collaborators
5atalog
+ser session
Good Practice: CRC CardGood Practice: CRC Card
enefits: t is easy to describe how classes wor* by moving
cards around; allows to Duic*ly consider alternatives.
(5lass esponsibility 5ollaborator)
-
7/25/2019 Eel4884 Esd Spr05 Uml
30/38
Se;uence 6iagram*make a phone call-Se;uence 6iagram*make a phone call-
+aller 3hone *ecipient
3ic>s up
%ial tone
%ial
*ing notification *ing
3ic>s up
?ello
-
7/25/2019 Eel4884 Esd Spr05 Uml
31/38
Se;uence 6iagram!4.ject interactionSe;uence 6iagram!4.ject interaction
Self-CallSelf-Call: A message that an
/bject sends to itself.
Condition: indicates when a
message is sent. &he message is
sent only if the condition is true.
teration
5ondition
(
$ynchronous
synchronous
Transmission
delayed
$elf-+all
-
7/25/2019 Eel4884 Esd Spr05 Uml
32/38
Se;uence 6iagrams , 4.ject Life SpansSe;uence 6iagrams , 4.ject Life Spans
'reation'reation
'reate message'reate message
4.ject life starts at that point4.ject life starts at that point
Acti8ationActi8ation
S)m.oli>ed .) rectangularS)m.oli>ed .) rectangular
stripesstripes
"lace on the lifeline where"lace on the lifeline where
o.ject is acti8ated/o.ject is acti8ated/
Cectangle also denotes whenCectangle also denotes when
o.ject is deacti8ated/o.ject is deacti8ated/ 6eletion6eletion
"lacing an ?@ on lifeline"lacing an ?@ on lifeline
4.ject@s life ends at that point4.ject@s life ends at that point
Activation bar
A
B
+reate
?eletion
eturn
6ifeline
-
7/25/2019 Eel4884 Esd Spr05 Uml
33/38
Sequence DiagramSequence DiagramUser +atalog *eservations
48 loo> up 12
@8 title data 12
A8 Bnot availa&leC reserve title 12
D 8 title returned 12
E8 hold title 12
E 8 title availa&le 12
F 8 &orrow title 12
F 8 remove reservation 12
G$e:uence diagrams demonstrate the &ehavior of o&"ects in a use case
&y descri&ing the o&"ects and the messages they pass#
GThe horizontal dimension shows the o&"ects participating in the interaction#
GThe vertical arrangement of messages indicates their order#
GThe la&els may contain the se:# 9 to indicate concurrency#
essage
-
7/25/2019 Eel4884 Esd Spr05 Uml
34/38
Interaction %iagrams8 +olla&oration diagramsInteraction %iagrams8 +olla&oration diagrams
User
+atalog
*eservations
start
48 loo> up@8 title data
A 8 Bnot availa&leC reserve title
D 8 title returned
E 8 hold title
F 8 &orrow title
F8 remove reservation
E8 title availa&le
G$hows the relationship &etween o&"ects and the order of messages passed &etween them#
&etween them#GThe o&"ects are listed as rectangles and arrows indicate the messages &eing passedGThe num&ers net to the messages are called se:uence num&ers# They show the se:uence
of the messages as they are passed &etween the o&"ects#
Gconvey the same information as se:uence diagrams, &ut focus on o&"ect roles instead of the
-
7/25/2019 Eel4884 Esd Spr05 Uml
35/38
State DiagramsState Diagrams
((Billing Example)Billing Example)
0tate ?iagrams show the seDuences of states an object goes
through during its life cycle in response to stimuli, together
with its responses and actions; an abstraction of all possible
behaviors.
+npaid
0tart #nd
-aidnvoice created paying nvoice destroying
-
7/25/2019 Eel4884 Esd Spr05 Uml
36/38
State DiagramsState Diagrams*Brac light eEample-*Brac light eEample-
Hellow
*ed
reen
Traffic Light
$tate
Transition
#vent
0tart
-
7/25/2019 Eel4884 Esd Spr05 Uml
37/38
UM! Mo"eling #oolsUM! Mo"eling #ools
*ational *ose*ational *ose *www/rational/com- .) I(M *www/rational/com- .) I(M
Together$oft +ontrol +enter, (orlandTogether$oft +ontrol +enter, (orland
**http!11www/.orland/com1together1indeE/htmlhttp!11www/.orland/com1together1indeE/html --
ArgoUM!ArgoUM!11free softwarefree software2211http!11argouml/tigris/org1http!11argouml/tigris/org122 !pen$ourceJ!pen$ourceJ written in "avawritten in "ava
!thers!thers 1http8KKwww#o&"ects&ydesign#comKtoolsKumltools.&y+ompany#html 21http8KKwww#o&"ects&ydesign#comKtoolsKumltools.&y+ompany#html 2
-
7/25/2019 Eel4884 Esd Spr05 Uml
38/38
CeferenceCeference
N/N/ UML Distilled:UML Distilled: (rief uide to the $tandard !&"ect Modeling Language (rief uide to the $tandard !&"ect Modeling LanguageMartin )owler, endall $cottMartin )owler, endall $cott
@#@#IBM RationalIBM Rationalhttp://www-306.i!.co!/"oftware/rational/#!l/http://www-306.i!.co!/"oftware/rational/#!l/
A#A# $ractical %M& --- ' an"-*n Intro#ction for +eeloper"$ractical %M& --- ' an"-*n Intro#ction for +eeloper" http://www.together"oft.co!/"erice"/practicalg#ie"/#!lonlineco#r"e/http://www.together"oft.co!/"erice"/practicalg#ie"/#!lonlineco#r"e/
..Software ngineering $rinciple" an $ractice.Software ngineering $rinciple" an $ractice.Secon itionSecon itionan" an 1liet.an" an 1liet.
5/ http!11wwwinst/eecs/.erkele)/edu1OcsNP15/ http!11wwwinst/eecs/.erkele)/edu1OcsNP1