handout2 extra
TRANSCRIPT
![Page 1: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/1.jpg)
November 7, 2005
Lilith Al-JadiriLehrstuhl für Angewandte Softwaretechnik
Institut für InformatikTechnische Universität München
Software EngineeringExercise
Modeling with UML:Sequence and Activity Diagrams
![Page 2: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/2.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 2
Content27.10.05 Modeling with UML: Use Case and class diagrams03.11.05 Modeling with UML: Sequence and activity
diagrams10.11.05 Requirements Elicitation17.11.05 Analysis24.11.05 System Design01.12.05 Dies Academicus08.12.05 Object Design: Using Design Patterns15.12.05 Object Design: Object Constraint Language22.12.05 to 12.01.06 Mapping models to code19.01.06 to 09.02.06 Miniproject: Asteroids26.01.06 to 02.02.06 Testing
![Page 3: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/3.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 3
Exercise 1
Consider an ATM system. Identify at least threedifferent actors that interact with this system?
![Page 4: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/4.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 4
Exercise 2
Can the system under consideration berepresented as an actor?
Justify your answer.
![Page 5: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/5.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 5
Exercise 3
What is the difference between a scenario and ause case?
When do you use each construct?
![Page 6: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/6.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 6
Exercise 4Draw a use case diagram for a ticket distributor for a trainsystem. The system includes two actors: a traveler, whopurchases different types of tickets, and a centralcomputer system, which maintains a reference databasefor the tariff. Use cases should include:BuyOneWayTicket, BuyWeeklyCard,BuyMonthlyCard, UpdateTariff. Also include thefollowing exceptional cases: Time-Out (i.e., traveler tooktoo long to insert the right amount),TransactionAborted (i.e., traveler selected the cancelbutton without completing the transaction),DistributorOutOfChange, andDistributorOutOfPaper.
![Page 7: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/7.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 7
Exercise 5
Write the flow of events and specify all fields for theuse case UpdateTariff that you drew in Exercise4.
Do not forget to specify any relationships.
![Page 8: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/8.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 8
Exercise 5: Use Case Template
Use case name UpdateTariff Participating Actors …. Flow of events 1. … 2. …. 3. … :
: :
Entry condition ….. Exit condition …. Quality requirements ….
![Page 9: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/9.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 9
Exercise 5: SolutionUse case name UpdateTariff
Participating Actors Initiated by CentralComputerSystem
Flow of events 1. The CentralComputerSystem activates the “UpdateTariff” function of the
ticket distributors available on the network.
2. The ticket distributor disables the traveler interface and
posts a sign indicating that the ticket distributor is under
maintenance.
3. The ticket distributor waits for the new database from the
CentralCo mputerSystem.
4. After waiting a minute for the ticket distributors to reach a waiting state,
the CentralComputerSystem broadcasts the new database.
5. The ticket distributor system receives the new database
of tariff. Upon complete, the ticket distributor sends an
acknowledgement to the CentralComputerSystem
6. After acknowledgment, the ticket distributor enables the
traveler interface and can issue tickets at the new tariff.
7. The CentralComputerSystem checks if all ticket distributors have
acknowledged the new database. If not, the CentralComputerSystem
invokes the CheckNonRespo ndingDistributo rs
use case.
Entry condition The ticket distributor is connected to a network reachable by the
CentralComputerSystem.
Exit condition The ticket distributor can issue tickets under the new tariff, OR
The ticket distributor is disabled and displays a sign denoting that it is
under maintenance.
Quality requirements The ticket distributor stays offline at most 2 minutes and is considered out-
of-order otherwise.
![Page 10: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/10.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 10
Exercise 6
Draw a class diagram representing a book definedby the following statement:
“A book is composed of a number of parts, which inturn are composed of a number of chapters.Chapters are composed of sections.”
Focus only on classes and relationships.
![Page 11: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/11.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 11
Exercise 7
Add multiplicity to the class diagram you producedin Exercise 6.
![Page 12: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/12.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 12
Exercise 6 & 7: Solution
Book
Part
Chapter
Section
1*
1
*
*
1
![Page 13: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/13.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 13
Exercise 8
Draw an object diagram representing the first partof the oose book (table of contents is on sheet 1).
Make sure that the object diagram you draw isconsistent with the class diagram of Exercise 6.
![Page 14: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/14.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 14
Exercise 9
Extend the class diagram of Exercise 6 to includethe following attributes:
• book includes a publisher, publication date, andan ISB
• a part includes a title and a number• a chapter includes a title, a number, and an
abstract• a section includes a title and a number
![Page 15: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/15.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 15
Exercise 9: Solution
Bookpublisher:PersonpublicationDate:DateISBN:Integer[4]
Part Chapter Sectiontitle:Stringnumber:Integer
title:Stringnumber:Integerabstract:String
title:Stringnumber:Integer
1 * 1 * 1 *
![Page 16: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/16.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 16
Exercise 10
Consider the class diagram of Exercise 9. Note thatthe Part, Chapter, and Section classes all includea title and a number attribute. Add an abstractclass and a generalization relationship to factorout these two attributes into the abstract class.
![Page 17: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/17.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 17
Exercise 10: Solution
Bookpublisher:PersonpublicationDate:DateISBN:Integer[4]
Part Chapter Sectionabstract:String
1 * 1 * 1 *
title:Stringnumber:Integer
NumberedComponent
![Page 18: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/18.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 18
Exercise 11
Draw a class diagram representing the relationshipbetween parents and children. Take into accountthat a person can have both a parent and a child.Annotate associations with roles and multiplicities.
Person
2*child
parent
Solution
![Page 19: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/19.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 19
Hand-out 2
![Page 20: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/20.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 20
Sequence Diagrams• Used during requirements analysis
– To refine use case descriptions– to find additional objects
(“participating objects”)• Used during system design
– to refine subsystem interfaces• Used during Testing
– to specify expected behaviour andvalidate output
• Classes are represented byrectangles
• Lifelines are represented bydashed lines
• Messages are represented byarrows
• Activations are represented bynarrow rectangles.
selectZone()
pickupChange()
pickUpTicket()
insertCoins()
TicketMachinePassenger
![Page 21: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/21.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 21
Sequence Diagrams: Dataflow
• The source of an arrow indicates the activation which sentthe message
• Horizontal dashed arrows indicate data flow, for examplereturn results from a message
Passenger
selectZone()
ZoneButton TarifSchedule Display
lookupPrice(selection)
displayPrice(price)
price
Dataflow…continued on next slide...
![Page 22: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/22.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 22
Sequence Diagrams: Iteration & Condition
• Iteration is denoted by a * preceding the message name• Condition is denoted by boolean expression in [ ] before the
message name
Passenger ChangeProcessor
insertChange(coin)
CoinIdentifier Display CoinDrop
displayPrice(owedAmount)
lookupCoin(coin)
price
[owedAmount<0] returnChange(-owedAmount)
Iteration
Condition
…continued on next slide...
…continued from previous slide...
*
![Page 23: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/23.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 23
Creation and destruction
• Creation is denoted by a message arrow pointing to the object.• Destruction is denoted by an X mark at the end of the destruction
activation.• In garbage collection environments, destruction can be used to denote
the end of the useful life of an object.
Passenger ChangeProcessor
…continued from previous slide...
Ticket
createTicket(selection)
free()
Creation
Destruction
print()
![Page 24: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/24.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 24
Exercise 1
Draw a sequence diagram for the warehouseOnFire
scenario of Figure 1. Include the objects bob, alice,
john, FRIEND, and instances of other classes youmay need. Draw only the first five messagesends.
![Page 25: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/25.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 25
Exercise 1 contd.
![Page 26: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/26.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 26
Exercise 1: Solution
![Page 27: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/27.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 27
Exercise 2
Draw a sequence diagram for the ReportIncident usecase of Figure 2. Draw only the first five messagesends. Make sure it is consistent with thesequence diagram of Exercise 1.
![Page 28: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/28.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 28
Exercise 2 contd.
![Page 29: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/29.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 29
Exercise 2: Solution
![Page 30: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/30.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 30
Activity Diagrams
• An activity diagram is a special case of a statechart diagram
• The states are activities (“functions”)• An activity diagram is useful to depict the
workflow in a system
HandleIncident
DocumentIncident
ArchiveIncident
![Page 31: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/31.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 31
Activity Diagrams allow to model Decisions
OpenIncident
NotifyPolice Chief
NotifyFire Chief
AllocateResources
[fire & highPriority]
[not fire & highPriority]
[lowPriority]
![Page 32: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/32.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 32
Activity Diagrams allow to model Concurrency
• Synchronization of multiple activities• Splitting the flow of control into multiple threads
OpenIncident
AllocateResources
CoordinateResources
DocumentIncident
ArchiveIncident
SynchronizationSplitting
![Page 33: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/33.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 33
Activity Diagrams: Grouping of Activities• Activities may be grouped into swimlanes to
denote the object or subsystem that implementsthe activities.
OpenIncident
AllocateResources
CoordinateResources
DocumentIncident
ArchiveIncident
Dispatcher
FieldOfficer
![Page 34: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/34.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 34
Exercise 3
Consider the process of ordering a pizza over thephone. Draw an activity diagram representingeach step of the process, from the moment youpick up the phone to the point where you starteating the pizza. Do not represent anyexceptions. Include activities that others need toperform.
![Page 35: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/35.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 35
Exercise 3: Solution
![Page 36: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/36.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 36
Exercise 4
Add exception handling to the activity diagram youdeveloped in Exercise 3. Consider at least threeexceptions (e.g. delivery person wrote downwrong address, deliver person brings wrongpizza, store out of anchovies).
![Page 37: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/37.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 37
Exercise 4: Solution
![Page 38: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/38.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 38
Classes in a Class Diagram• Class name only Example
• With Details Example
Class NameBank
Account
Class Nameattributesmethods
Bank Accountdouble balance
deposit()withdraw()
![Page 39: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/39.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 39
Relationships• Inheritance (arrow)
– example: between Secretary and Employee• Composition/Aggregation (diamond)
– example: between Car and Wheel• Association (line)
– example: between Borrower and Book
![Page 40: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/40.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 40
Inheritance
Secretary
Employee
public class Secretary extends Employee { …}
![Page 41: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/41.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 41
Composition/Aggregation
Car Wheel4
w[]
public class Car { Wheel w[]; ... public Car() { w = new Wheel[4]; … } ...}
Note: [ ] in diagramis sometimes left outsince w does not needto be an array
![Page 42: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/42.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 42
Association
Borrower BookcurrBorr bk[]
31
public class Borrower { Book bk[]; … public Borrower() { bk = new Book[3]; }}
public class Book { Borrower currBorr; …}
![Page 43: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/43.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 43
Notational Details• Cardinality
– Specifies the number of objects that may participate inthe relationship
• Roles and Navigability– Specifies relationship name and access
• Aggregation versus Composition• Dependencies
![Page 44: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/44.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 44
Cardinality• Also known as multiplicity
– Exact number (mandatory)– Range (e.g., 0..5)– * (many-valued)
• Specifies the number of objects that may beassociated with an object of the other class
• For associations, multiplicity is specified on bothparticipants
![Page 45: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/45.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 45
Roles and Navigability• Role name placed on the side of a participant• Let A and B be associated classes and let rrr be
the role specified on B’s side– rrr is the role of B in the relationship– rrr is a member in class A– rrr refers to one or more (depending on multiplicity) B
objects• An arrowhead indicates the ability to access B
participant(s) from A
![Page 46: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/46.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 46
Uni-directional Navigability
PriceChecker
getPrice()
pcFastFoodCounter
public class FastFoodCounter { PriceChecker pc; … public void add( … ) { … double pr = pc.getPrice(); … } …}
public class PriceChecker { // no access to counter}
![Page 47: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/47.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 47
Bi-directional Navigability
Borrower BookcurrBorr bk[]
31
public class Borrower { Book bk[]; … public Borrower() { bk = new Book[3]; }}
public class Book { Borrower currBorr; …}
Note: double arrowheads maybe omitted (bi-directionalnavigability assumed)
![Page 48: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/48.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 48
Aggregation versus Composition• Part-of relationships• Aggregation
– Part may be independent of the whole but the wholerequires the part
– Unfilled diamond• Composition (“stronger” form of aggregation)
– Part is created and destroyed with the whole– Filled diamond
• Definitions and distinctions between aggregationand composition still “under debate”
![Page 49: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/49.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 49
Association/Aggregation/Composite• Composition
– E.g., Glider has a component Tail– Composite object is the whole– Component is the part
• Composite cannot exist without component• A component is part of only one composite
– Stronger: composite should create component– Stronger: if delete composite, component goes away
too, i.e., cascading delete– Typically a composite has many different kinds of
components
![Page 50: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/50.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 50
Whole/Part Associations• Aggregation, weaker than composition
– E.g., City is an aggregate of houses– Aggregate is the whole– Constituent is the part
• Aggregate may exist without constituents• Each object may be part of more than one
aggregate• Typically, constituents are of same class
![Page 51: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/51.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 51
Composition/Aggregation Notations
MovieTheater BoxOffice
Movie
1 1
0..*
0..*
composition
aggregation
whole
part
part
![Page 52: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/52.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 52
Composition vs. Aggregation• In real world there are 7 or 8 varieties of
whole/part relationships, but UML has only twoconstructs – composition and aggregation
• It can be very difficult, and confusing to chooseone
• UML 2.0 has essentially deprecated aggregation– So, don’t use it (choose composition or association)– But you might see it
![Page 53: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/53.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 53
Dependencies• Some classes use other classes but are not
related to them in ways previously discussed• Not relationships in the sense that participants do not become
attributes in another class
• Most common example:– As local variables in (or arguments to) a method of the
class
![Page 54: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/54.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 54
Dependency Example
Parser
getOrder()
usesRestaurant
processOrders()
public class Restaurant { … public void processOrders() { Parser p = new Parser(…); // call getOrder() in this method } …}
![Page 55: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/55.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 55
Association/Aggregation/Composition
Window
Slider Header Panel
1 1 1
2 11scroll title body
Windowscrollbar[2]: Slidertitle: Headerbody: Panel
![Page 56: Handout2 Extra](https://reader030.vdocuments.site/reader030/viewer/2022013114/5517556c4a7959813b8b46c0/html5/thumbnails/56.jpg)
November 7, 2005Software Engineering Exercise 1Lilith Al-Jadiri 56
Mandatory Parts
Car Wheel4
wheels
public class Car{private Wheel wheels[4]; // wheel objects are created externally ...public Car(Wheel w1, Wheel w2, … ) … // wheels required in constructor // w1, w2, … will be checked for null values}