Michael Eichberg
Software Engineering
Department of Computer Science
Technische Universitt Darmstadt
Domain Model
Why:
Domain modeling helps us to identify the
relevant concepts and ideas of a domain
When:
Domain modeling is done during object-oriented
analysis
Guideline:
Only create a domain model for the tasks at
hand
Domain Model |
Domain Model |
Conceptual Classes
Domain Model |
Visualizing
Domain Models
Exemplified
(By means of a basic course management system.)
Exercise
Tutor
Semester
Lecture
Study Group
Student
Lecturer
Grade
Student
name
/bonus : Percentage
attributes
Exercise
Solution
task
submission date
exercise points
name
Student
consists of
1
2..3 name
/bonus : Percentage
Study Group
association
multiplicity
Lecturer
reads
*
Lecture
Student
Study Group
Lecture
2,3 name
/bonus : Percentage
1..*
attends
Student
name
1..*
is tutor for
*
Lecture
* description
Student
attends
Lecture
2..3
description
owns
consists of
name
1..*
/bonus : Percentage
Lecturer
reads
*
name
1
12..14
Exercise
StudyGroup
solves
*
Solution
task
submission date
exercise points
Domain Modeling
Overview
Domain Modeling | 16
?
Which are noteworthy domain concepts / domain
objects?
explained
in the
following
Use the domain vocabulary; e.g. a model for a library should use names
like Borrower instead of customer.
{balance = sum(entries.amount)}
Acount
balance: Quantity
0..*
Entry
amount: Quantity
whenChanged: Timepoint
Domain Modeling | 19
Classes
(for the POS system)
Business transactions...
Sale, Payment
SalesLineItem
Item
Register
Cashier, Customer, Store
Store
Sale, Payment
...
Should Receipt be in
the domain model?
A receipt is just a
report of a sale and a
payment...
Facts:
Identied candidate conceptual classes: ... Receipt, .
A receipt is just a report of a sale and a payment...
Domain
Requirement
Rule of Thumb:
If we do not think of some
conceptual class X as a
number, date or text in the real
world, X is probably a
conceptual class, not an
attribute.
Exercise
StudyGroup
Solution
achieved exercise points
task
submission date
exercise points
Rule of Thumb:
If we do not think of some conceptual class X as a number or text
in the real world, X is probably a conceptual class, not an
attribute.
Should destination be an attribute of flight, or a conceptual
class airport?
A destination airport is a building at a specic place, it is not
just a number or some text.
Hence, it should be a conceptual class.
*
*
Flies-from 1
Flies-to
Airport
Rule of Thumb:
Include associations in the
domain model for which
knowledge of the relationship
needs to be preserved for some
duration.
Good examples:
Player Is-on Square!
Sale Paid-by CashPayment
Bad examples:
Sale Uses CashPayment
(Uses is usually generic and doesnt tell us anything.)
Player Has Square
(Has is usually generic and doesnt tell us anything.)
avoid:
recommended:
Cashier
name
currentRegister
?
Cashier
name
Register
number
avoid:
recommended:
Cashier
name
currentRegister
Cashier
name
Register
number
avoid:
recommended:
ProductDescription
itemId : ItemId
ProductDescription
1
1
ItemId
id
countryCode
Domain Modeling | 39
Which are
noteworthy domain concepts / domain objects
?
Domain Modeling | 40
Sales
LineItem
quantity
Records-sale-of
0..1
Item
1
*
1..*
Stocked-in
Contained-in
1
Sale
date
time
Store
address
name
0..1
Captured-on
Paid-by
Houses
1
Payment
amount
Register
Domain Model
Payment
amount
Sale
date
time
inspiration / basis
Payment
amount: Money
getBalance():Money
Sale
date: Date
startTime: Time
getTotal(): Money
Design Model
The goal of this lecture is to enable you to systematically carry out small(er)
commercial or open-source projects.
Domain Modeling
Project
Start
Start of an iteration
Requirements Management
Domain Modeling
Project
End