Software Design and UML Discussion Attachment
1
The Examples of Documents to Be Read Example 1: A use case for an automated system at a gas station, describing how a customer purchases a parking spot. Note that “ time of payment is the same as purchase time” is a condition; it describes what must be true for the functionality to be executed. “ The Customer can only wait for 30 seconds for the authorization process” imposes a constraint that must be always be true for system functionality.
A customer, giving his account_number, asks the Gas Station Owner for an available parking spot to park his car. To get an available parking spot Gas Station Owner searches for the next parking place available. With this information the customer can confirm the lease of the parking place. The time of payment (time of purchase or a monthly paper bill ) and how the service should be paid (by cash, personal check or credit card). If the time of payment is the same as the purchase time and Customer decides to pay by Credit Card then Credit Card system should be used. The Customer can only wait for 30 seconds for the authorization process otherwise this payment should be made by cash or personal check to avoid other Customers waiting on the lane. The Gas Station Owner should ask the Customer for a new payment type. It allows the Gas Station Owner to mark a new service purchase for this Customer at this date.
Customer billing services
Credit_Card System
parking Gas Station Owner
2
Example 2: A sequence diagr am for the automated gas station system, captur ing how classes coll abor ate to per for m the functionality descr ibed in Example 1. Combinations of messages that for m system services have been mar ked. Conditions and constr aints ar e included as annotations on the diagr am. “ Response time < 30 secs” r epr esents a nonfunctional constraint on the way cer tain functionality has to be implemented. “ Payment
time = monthly” is an example of a condition that must be tr ue for a par ticular message to be executed; in this case, the system var iable “ payment t ime” must have the value “ monthly.” Example 3: The class diagr am for the classes descr ibed in Example 2. Note that constraints on system functionality ar e r epr esented as annotations on classes.
Credit_Card System
+ authorize_payment(customer, amount, date)()
(from External Systems)
Parking_Spot Place : text
is_available() next_available()
Purchase Purchase_Date : Date Tax : number
price() taxes() new_purchase(customer, parking_spot)()
Customer
- name : text - address : text - SSN : number - Birthday : Date - Account_number : number
+ opname() + new_payment_type_request()()
(from Customers)
0..*
1
0..*
1
Bill Issue_Date : Date Payment_Date : Date
price() taxes() customer() purchases() add_to_bill(customer, amount, date)()
1..*1 1..*1
Gas Station Owner
parking_spot_request()
1..*
1
1..*
1
1 1
1 1
0..*
1
0..*
1
0..*
1
0..*
1
[ response time should be less than 30 secs for all Credit Card Systems ]
Customer : Customer
Gas Station Owner : Gas Station Owner
Credit Card System : Credit_Card System
Purchase : Purchase
Customer Bill : Bill
Parking Spot : Parking_Spot
parking_spot_request( account_number) next_available( )
where_to_park( available parking_spot)
lease_parking_spot(parking_spot, payment time, payment type)
authorize_payment(customer, amount, date)
[ Payment type = Credit Card and payment time = now]
new_purchase(customer, parking_spot, date)
add_to_bill(customer, amount, date)
[ payment time = monthly] new_payment_type_request()
[ response time => 30 secs or credit card not authorized and payment time = now]
[response time < 30 secs]
3
Example 4: Requir ements descr iptions and Class descr iptions used to show how conditions and constr aints should be consider ed while r eading both documents. Obser ve the r elationship between both documents shown by the under lined infor mation. Requir ement Descr iption 1 – A customer has the option to be bill ed automatically at the time of purchase (of gas, car maintenance or parking spots) or to be sent a monthly paper bill . Customers can pay via cash, credit card or personal check. Gas Station services have a fixed price (gas: US$ 1.09 gallon, car maintenance: US$ 150.00 and parking spot: US$ 5.00 per day). The tax is 5% added to the final price of the purchase. Sometimes, the Gas Station owner can define discounts to those prices.
Class Descr iption Class name: Pur chase Category: Customers External Documents: Export Control: Public Cardinality: n Hierarchy: Superclasses: none Public Interface: Operations: price taxes Private Interface: Attributes: Purchase_Date : Date Tax : number Service: Services Implementation: Attributes: Purchase_Date : Date Tax : number = 0.05 Operation name: price Public member of: Purchase Concurrency: Sequential Return (1 + tax) * service- >price Operation name: taxes Public member of: Purchase Concurrency: Sequential Return tax * service->price Class name: Ser vices Category: Services
External Documents: Export Control: Public Cardinality: n Hierarchy: Superclasses: none Public Interface: Operations: price Private Interface: Attributes: Discount_Rate : number Price : number Implementation: Attributes: Discount_Rate : number Price: number Operation name: price Public member of: Services Concurrency: Sequential Return (1 - discount_rate ) * price Class name: Car _M aintenance Category: Services External Documents: Export Control: Public Cardinality: n Hierarchy: Superclasses: Services Public Interface: Operations: price Private Interface: Attributes:
4
Price : number Implementation: Attributes: Price : number = 150.00
5
Example 5: A state diagr am for the “gas station owner ” class fr om the automated gas station system. An associated sequence diagr am is shown in Example 2.
Authorizing
Authorized
Purchased
Rejected
[payment not OK][payment ok]
[time <= 7]