♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence...
-
Upload
willis-dixon -
Category
Documents
-
view
227 -
download
3
Transcript of ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence...
![Page 1: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/1.jpg)
♦ Domain model•Conceptual classes & attributes
•Association & multiplicity
♦ System sequence diagram
1
Review
![Page 2: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/2.jpg)
Domain model
Applying UML and Patterns
-Craig Larman
![Page 3: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/3.jpg)
Domain model representation? A domain model is a visual representation of real world concepts
(real-situation objects ), that could be : idea, thing , event or
object…..etc .
Business objects - represent things that are manipulated in the
business e.g. Order.
Real world objects – things that the business keeps track of
e.g. Contact , book.
Events that transpire - e.g. sale, loan and payment.
![Page 4: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/4.jpg)
4
Method1: Noun Phrase Identification
Identify Nouns and Noun Phrases in textual
descriptions of the domain that could be :
• The fully dressed Use Cases
• The problem definition.
But not strictly a mechanical process. Why ?
• Words may be ambiguous ( such as : System )
• Different phrases may represent the same concepts.
![Page 5: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/5.jpg)
5
Method2 : By Category List (read p 140-141)
Common Candidates for classes include:
• Descriptions , Roles , Places , Transactions
• Containers , Systems , abstract nouns , Rules
• Organizations, Events, Processes, catalogs , Records , services.
![Page 6: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/6.jpg)
Attributes
A logical data value of an object. Imply a need to remember information.
• Sale needs a dateTime attributte
• Store needs a name and address
• Cashier needs an ID
Use case scenarios are examined to discover also attributes
6
![Page 7: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/7.jpg)
7
A Common Mistake when modeling the domain- Classes or Attributes?
RuleIf we do not think of a thing as a number or text in the real world, then it is probably a conceptual class.If it takes up space, then it is likely a conceptual class.
Examples:Is a store an attribute of a Sale ? Is a destination an attribute of a flight ?
![Page 8: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/8.jpg)
SaleRegister Records-current 0..11
association name multiplicity
-"reading direction arrow"-it has no meaning except to indicate direction of reading the association label-often excluded
Relationship between classes (more precisely, between instances of those
classes)indicating some meaningful and interesting connection
Association
![Page 9: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/9.jpg)
Common association list
A is a physical part of B .
• Wing - Airplane
A is a logical part of B
• SalesLineItem - Sale
A physical contained in B
• Register-Sale
9
![Page 10: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/10.jpg)
Common association list
A is a logical contained in B
• ItemDescription - Catalog
A is a description of B .
• ItemDescription - Item
A is a member of B
• Cashier – Store
A uses or manage B
• Cashier-Register10
![Page 11: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/11.jpg)
Common association list
A is recorded in B
• Sale-Register
A is an organization subunit of B .
• Departement - Store
A communicate with B
• Customer - Cashier
11
![Page 12: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/12.jpg)
Common association list
A is related to a transaction B
• Customer - Payment
A is a transaction related to another transaction B .
• Payment - Sale
A is owned by B
• Register - Store
A is an event related to B
• Sale- Customer12
![Page 13: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/13.jpg)
High priority association
• A is a physical or logical part of B
• A is physically or logically contained in/on B
• A is recorded/known/reported / captured in B
NB:
• Avoid showing redundant or derivable associations
• Do not overwhelm the domain model with associations not strongly
required13
Association
![Page 14: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/14.jpg)
Examples
14
Sale is recorded in a register
SalesLineItem is a logical part of Sale
![Page 15: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/15.jpg)
ItemStore Stocks
*
multiplicity of the role
1
“many” ( 0 or more )
Multiplicity indicates how many instances can be validly associated with another instance, at a particular moment, rather than over a span of time.
Example : monogamy
Multiplicity
![Page 16: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/16.jpg)
System Sequence diagram
Applying UML and Patterns
-Craig Larman
![Page 17: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/17.jpg)
![Page 18: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/18.jpg)
Develop SSDs for the main success scenario of a selected use case, then frequent alternative scenarios
Relationship SSD and Use case
![Page 19: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/19.jpg)
Process Sale
enterItem(itemID, quantity)
:System: Cashier
endSale
makePayment(amount)
a UML loop interaction frame, with a boolean guard expression
external actor to system
Process Sale Scenario
system as black box
the name could be "NextGenPOS" but "System" keeps it simple
the ":" and underline imply an instance, and are explained in a later chapter on sequence diagram notation in the UML
a message with parameters
it is an abstraction representing the system event of entering the payment data by some mechanism
description, total
return value(s) associated with the previous message
an abstraction that ignores presentation and medium
the return line is optional if nothing is returned
total with taxes
change due, receipt
makeNewSale
[ more items ]loop
![Page 20: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/20.jpg)
20
Example
![Page 21: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/21.jpg)
21
Car rental system
![Page 22: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/22.jpg)
Car rental system
![Page 23: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/23.jpg)
Use case : rent a car
The use case begins when the customer selects ”Book Now”.
The system displays the available cars
The customer selecst the type of car in the checkbox that
contains:
Sport cars
Station wagon
Normal
The system displays the list of available cars
![Page 24: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/24.jpg)
Use case : rent a car
The customer enters the pick-up/ drop-off date and place.
The system displays cars availbale with the fair
The customer selects the requested car.
The system display a confirmation screen that contains:
The car rented
Pick up/ drop off date and place
Amount the customer has to pay
The user confirms the criteria and the use case ends.
![Page 25: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/25.jpg)
Chap 11Operation Contracts
Chapter 11
Applying UML and Patterns
-Craig Larman
![Page 26: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/26.jpg)
Operation Contract
Operation contract identifies system state changes when an operation happens.
Define what each system operation does An operation is a single event from the
system sequence diagram A domain model is used to help generate
an operation contract
26
![Page 27: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/27.jpg)
Operation Contract When making an operation contract,
think of the state of the system before the action and the state of the system after the action.
The conditions both before and after the action should be described in the operation contract.
The pre and post conditions describe state, not actions.
27
![Page 28: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/28.jpg)
Sections of an Operation Contract
Operation: Name of the operation and parameters
Cross References: Use cases and scenarios this operation can
occur within
Preconditions: Noteworthy assumptions about the state of the
system or objects in the Domain Model before execution of the
operation.
Postconditions: This is the most important section. The state
of objects in the Domain Model after completion of the operation
![Page 29: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/29.jpg)
Postconditions: most important
Describe changes in the state of objects in the domain model after completion of the operation
• what instances were created ?
• what associations were formed/broken?
• what attributes changed? Are not actions to be performed during the
operation
![Page 30: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/30.jpg)
Examples of Operation Contracts
From Process Sale Use Case
![Page 31: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/31.jpg)
Main Success Scenario (or Basic Flow):
• 1. Customer arrives at POS checkout with goods and/or services to purchase.
• 2. Cashier starts a new sale.
• 3. Cashier enters item identifier.
• 4. System records sale line item and presents item description, price, and running total.
• Price calculated from a set of price rules.
• Cashier repeats steps 3-4 until indicates done.
• 5. System presents total with taxes calculated.
• 6. Cashier tells Customer the total, and asks for payment.
• 7. Customer pays and System handles payment.31
![Page 32: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/32.jpg)
POS Domain Model
Register
ItemStore
Sale
CashPayment
SalesLineItem
CashierCustomer
ProductCatalog
ProductDescription
Stocks
*
Houses
1..*
Used-by
*
Contains
1..*
Describes
*
Captured-on
Contained-in
1..*
Records-sale-of
0..1
Paid-by Is-for
Logs-completed
*
Works-on
1
1
1
1 1..*
1
1
1
1
1
1
1
0..1 1
1
Ledger
Records-accounts-
for
1
1
![Page 33: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/33.jpg)
Operation: makeNewSale() Cross References:
• Use Case: Process Sale
• Scenario: Process Sale Preconditions: none Postconditions
• a sale instance “s” was created (instance creation)
• s was associated with the Register (association formed)
• attributes of s were initialized
Operation Contract for makeNewSale operation
![Page 34: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/34.jpg)
s :Sale
saleDate = currentDate()saleTim e = currentTime()saleNum = nextSaleNum()isCom plete = false
Regis ter111 1
association was created
s:Sale was created
attributes of s:Sale were initialized
![Page 35: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/35.jpg)
Operation Contract for enterItem operation
Operation: enterItem(itemID,quantity) Cross References:
• Use Case: Process Sale
• Scenario: Process Sale Preconditions: There is a sale underway.
![Page 36: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/36.jpg)
Operation Contract for enterItem operation Postconditions:
• A salesLineItem instance sli was created (instance creation)
• sli was associated with the current Sale (association formed)
• sli.quantity became quantity (attribute modification)
• sli was associated with a ProductDescription, based on itemId match (association formed)
![Page 37: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/37.jpg)
s:Sale
saleDatesaleTimesaleNumisComplete
ProductSpecification
sli:SalesLineItem
quantity1 1..n1 1..n
n
11
n
associations were created
sli:SalesLineItem was createdsli.quantity was initialized to input quantity
![Page 38: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/38.jpg)
Operation: endSale() Cross References:
• Use Case: Process Sale
• Scenario: Process Sale Preconditions: There is a sale underway Postconditions
• s.isComplete became true (attribute modification)
Operation Contract for endSale operation
![Page 39: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/39.jpg)
s :Sale
saleDatesaleTimesaleNumisCom plete
s.isComplete became true
![Page 40: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/40.jpg)
Operation: makePayment(amount:Money) Cross References:
• Use Case: Process Sale
• Scenario: Process Sale Preconditions: There is a sale underway
Operation Contract for makePayment operation
![Page 41: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/41.jpg)
Postconditions• a payment instance “p” was created (instance
creation)
• p.amountTendered became amount (attribute modification)
• p was associated with s:Sale (association former)
• s:Sale was associated with the Store (association formed)
Example—Operation Contract for makePayment operation
![Page 42: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/42.jpg)
What this looks like:
p:Payment
amountTendered
Store
s:Sale
saleDatesaleTimesaleNumisComplete
11 11
n
1
n
1
associations were created
p:Payment was createdp.amountTendered was initialized to input amount
![Page 43: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/43.jpg)
Why Operation Contracts?
An excellent tool of OO requirements analysis that describes in great detail the changes required by a system operation (in terms of the domain model objects) without having to describe how they are to be achieved
Excellent preparation for opening the System black box!
![Page 44: ♦ Domain model Conceptual classes & attributes Association & multiplicity ♦ System sequence diagram 1 Review.](https://reader036.fdocuments.net/reader036/viewer/2022062408/56649edf5503460f94bef353/html5/thumbnails/44.jpg)
Questions Please ?
44