University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 1 Use...
-
Upload
buddy-miles -
Category
Documents
-
view
216 -
download
3
Transcript of University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 1 Use...
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 1
Use Cases Use CaseModel
CampaignManagement
Package ModelSub-system
«subsystem»
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 2
• Object flows– open arrow
• Objects– rectangle– optionally shows the state of the
object in square brackets
Record completionof a campaign
:Campaign
[Active]
:Campaign
[Completed]
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 3
Stereotypes
Boundary objects model interaction between the system and actors (and other
systems)
Entity objects represent information and behaviour in the application
domain
Control objects co-ordinate and control other objects
AddAvert
Campaign
User Interface::AddAdvertUI
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 4
User Interface::AddAdvertUI
User Interface::AddAdvertUI
startInterface( )assignStaff( )selectClient( )selectCampaign( )
<<boundary>>User Interface::AddAdvertUI
startInterface( )assignStaff( )selectClient( )selectCampaign( )
Campaign
Campaign
titlecampaignStartDatecampaignFinishDate
getCampaignAdverts( )addNewAdvert( )
<<entity>>Campaign
titlecampaignStartDatecampaignFinishDate
getCampaignAdverts( )addNewAdvert( )
AddAvert
Control::AddAdvert
showClientCampaigns( )showCampaignAdverts( )createNewAdvert( )
<<control>>Control::AddAdvert
showClientCampaigns( )
showCampaignAdverts( )
createNewAdvert( )
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 5
FoodCo:Client
Yellow Partridge:Client
Soong Motor Co:Client
Grace Chia:StaffMember
Carlos Moncada:StaffMember
A link is a logical connection between two objects
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 6
StaffMember
staffName
staffNo
staffStartDate
Client
companyAddress
companyEmail
companyFax
companyName
companyTelephone
liaises with
staffContact
Association role Association
Association name Direction in which name should be read
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 7
StaffMember
staffName
staffNo
staffStartDate
Client
companyAddress
companyEmail
companyFax
companyName
companyTelephone
1 0..*
liaises with
Multiplicities
Exactly one staff member liaises with each client
A staff member may liaise with zero, one or more clients
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 8
Operations describe what instances of a class can do:Set or reveal attribute values
Perform calculations
Send messages to other objects
Create or destroy links
Campaign
actualCostcampaignFinishDatecampaignStartDatecompletionDatedatePaidestimatedCosttitlecheckCampaignBudget ( )getCampaignContribution ( )recordPayment ( )setCompleted ( )
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 9
Campaign Manager
Add a new advert to a campaign
Advert
setCompleted()
createNewAdvert()
<<entity>>
User Interface::AddAdvertUI
startInterface()
createNewAdvert()selectClient()
selectCampaign()
<<boundary>>
Campaign
title
campaignStartDate
campaignFinishDate
getCampaignAdverts()
addNewAdvert()
<<entity>>
1 0..*
conducted by
Client
companyAddress
companyName
companyTelephone
companyFax
companyEmail
getClientCampaigns()
getClients()
<<entity>>
1 0..*
places
Control::AddAdvert
showClientCampaigns()
showCampaignAdverts()
createNewAdvert()
<<control>>
13
4Add a new advert to a campaign
:Advert
:Campaign
:Client
:AddAdvert
:AddAdvertUI
2
3.1.1: listCampaigns
3.1.1.1 *[For all client’s campaigns]: getCampaignDetails
5.1.1.1: Advert
4.1.1.1 *[For all campaign’s adverts]: getAdvertDetails
:AddAdvertUI :AddAdvert
:Client :Campaign
:Advert
3.1: showClientCampaigns3: selectClient
4: selectCampaign 4.1: showCampaignAdverts
5: createNewAdvert 5.1: addNewAdvert
newAd:Advert
2: startInterface
1 *[For all clients]: getClient
:CampaignManager
sd Add a new advert to a campaign
5.1.1: addNewAdvert
4.1.1: listAdverts
There is a clear development path in realizing a use case… First, as a collaboration of possible classes that together could deliver the necessary functionality…. Second, as a communication diagram that shows how those classes might interact…. Finally, as a class diagram that shows how the classes could be specified and associated with each other.
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 10
Class Name Client
Responsibilities Collaborations
Provide client information.
Campaign provides campaign details.
Class Name Campaign
Responsibilities Collaborations
Provide campaign information.
Provide list of adverts.Add a new advert.
Advert provides advert details.Advert constructs new object.
Class Name Advert
Responsibilities Collaborations
Provide advert details.
Construct adverts.
Provide list of campaigns.
Example CRC cards
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 11
Class Student0..*1..*
Meal Ingredient1..*1
Filled diamond signifies composition
Aggregation (clearly not composition)
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 12
calculateBonus ( )
StaffMember{abstract}
staffNamestaffNostaffStartDatecalculateBonus ( )assignNewStaffGrade ( )getStaffDetails ( )
CreativeStaff
qualification
assignStaffContact ( )
AdminStaff
calculateBonus ( )
Add generalisation structures when:Two classes are similar in most details,
but differ in some respects
May differ:In behaviour (operations or methods)
In data (attributes)
In associations with other classes
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 13
Components = replaceable part of a system (e.g. executable software module with well-defined interface and identity )
«interface»Allocate Seats
GetFreeSeats(seatType)
AllocateSeat(seatRef)
DeallocateSeat(seatRef)
Flight Management
«component» «realize»
University of Toronto at Scarborough © Bennett, McRobb and Farmer 2005 CSCC40 classes 14
A pattern “describes a problem which occurs over and over again in our environment, and then describes the core of a solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice.” Alexander et al. (1977)
Transaction
transactionNumbertransactionDatetransactionTotal
updateTransactionTotal ( )
TransactionLineItem
TransactionLineNumbertransactionLineQuantitytransactionLineValue
comprises
*1
Simple Analysis Pattern