Documente Academic
Documente Profesional
Documente Cultură
Object Oriented
Analysis and Design
BITS Pilani Harvinder S Jabbal
Session 07: Domain Model
Pilani|Dubai|Goa|Hyderabad
Outline
No Title
CS3.1.1 Explain how Domain Concepts are different than
software classes, how domain concepts to be
identified?
Domain Concepts
Overview
5
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Guideline: show real-situation conceptual
classes, not software classes
Sale
void software class; not part
a date of domain model
time
print()
UP Design Model
The object-oriented developer has taken inspiration from the real world domain
in creating software classes.
date
time
sale-1
sale-3
sale-2 concept's extension
sale-4
13
use cases sys. sequence diagrams domain
BITS modelsto be University
Pilani, Deemed operation contract
under Section 3 of UGC Act, 1956
Initial PoS Domain Model
Sales
Cashier Customer Ledger
LineItem
concept Sales
Item
or domain LineItem Records-sale-of
object 1
quantity 0..1
1..* *
Stocked-in
association Contained-in
1 1
Sale Store
attributes date address
time 0..1 name
1
1
Houses
Paid-by 1..*
1 Register
Captured-on
Payment
1
amount
1
Rents 1..*
Customer VideoStore
Video
address Rents-from address Stocks
name
* 1
name 1 * ID
phoneNumber phoneNumber
Payment
attributes
date : Date
time : Time
amount : Money
Item
description Worse
price
serial number
itemID
ProductDescription
Item
description Describes Better
price 1 * serial number
itemID
Flight
Airport
date Flies-to Worse
number 1 name
time *
Flight
FlightDescription Better
Described-by
date
time * 1 number
*
Describes-flights-to
1
Airport
name
attributes
Sale
dateTime
/ total : Money derived
attribute
association
Records-current
Register Sale
1 1
zero or more;
* T
"many"
Customer
One instance of a
1..*
T one or more Customer may be
0..1 renting zero or more
Videos.
Rents
1..40
T one to forty One instance of a Video
may be being rented by
* zero or one Customers.
5
T exactly five Video
3, 5, 8 exactly three,
T
five or eight
27
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Multiplicity is context
dependent
Store Stocks Item
1
or 0..1
*
The answer depends on our interest in using the model. Typically and practically, the muliplicity communicates a
domain constraint that we care about being able to check in software, if this relationship was implemented or
reflected in software objects or a database. For example, a particular item may become sold or discarded, and thus
no longer stocked in the store. From this viewpoint, "0..1" is logical, but ...
Do we care about that viewpoint? If this relationship was implemented in software, we would probably want to ensure
that an Item software instance would always be related to 1 particular Store instance, otherwise it indicates a fault or
corruption in the software elements or data.
This partial domain model does not represent software objects, but the multiplicities record constraints whose
practical value is usually related to our interest in building software or databases (that reflect our real-world domain)
with validity checks. From this viewpoint, "1" may be the desired value.
1 Rents ...
...
Low value association.
Possible, but so what?
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
GUIDELINES: Attributes
Why??
Customer Video
Worse
rentedVideos: List of Video renter : Customer
* Flies-to 1
Flight Airport
Flies-from
1
*
Demonstration
Domain Model- Visual
Dictionary
Pays-for-overdue-charges
VideoRental
0..1
CashPayment RentalTransaction
Pays-for
Concepts,
1 dueDate
amount : Money 1 1 date 1 returnDate
1 1..*
returnTime
* *
Words, 1 1
Initiates
Rents
Records-rental-of
Things Customer
In the *
name name 1 ID 1
phoneNumber * 1
phoneNumber
1
* *
1
1
Domain Has
1
Maintains
Owns-a
1
Membership * Catalog
ID 1
startDate
Described-by
1
1..*
LoanPolicy VideoDescription
Defines 1
perDayRentalCharge title
perDayLateCharge 1..* subjectCategory
1..* 1
Determines-rental-charge
Product
Ledger Product Description
Catalog Contains
1 1..*
1 1
1
0..1 Records-
Used-by Describes
accounts-
Sales for * *
LineItem Store
Item
Stocks
1 1
* 1..*
1..*
1 Houses
Contained-in Logs-
1 completed 1..*
Sale * Register
Captured-on
0..1 1
1 1 1
Paid-by Is-for Works-on
1 1 1
SalesLineItem Item
0..1 Records-sale-of 1..* Each line item can record a
group of the same kind of items.
For example, 6 tofu packages.
SalesLineItem Item
0..1 Records-sale-of 1..*
/quantity
Cashier
Worse not a "data type" attribute
name
currentRegister
Cashier Register
Better 1 Uses 1
name number
ItemID Address
Product 1 1 1 1 street1
OK id Store
Description street2
manufacturerCode
countryCode cityName
...
Product Store
Description
OK address : Address
itemId : ItemID
Cashier
Worse a "simple" attribute, but being
name used as a foreign key to relate to
currentRegisterNumber another object
Cashier Register
Better 1 Works-on 1
name number
Payment
not useful
amount : Number
Product
Ledger Product Description
Catalog Contains
1 itemID
1..*
description
1 1
1 price
0..1 Records-
Used-by Describes
accounts-
Sales for * *
LineItem Store
Item
Stocks
quantity 1 name 1
address * 1..*
1..*
1 Houses
Contained-in Logs-
1 completed 1..*
Sale * Register
dateTime Captured-on id
0..1 1
/ total
1
1 1
Paid-by Is-for Works-on
1 1 1
amountTendered id
Domain
Business Model
Partial artifacts,
Modeling * refined in each
* iteration.
Use-Case Model
:System
foo( x )
Requirements
bar( y )
system
text use system operations
system
use case sequence operation
cases diagrams diagrams contracts
Design Model
Design
By Craig Larman