Unit 2 Domain Model
Unit 2 Domain Model
A feasibility study
• Most use cases written in brief format; 10‐20% of cases written in fully
dressed format
• Inception is the initial short step to establish a common vision and basic scope
for the project
– Include analysis of perhaps 10% of the use cases,
– Do the stakeholders have basic agreement on the vision of the project, and is it worth
investing in serious investigation?
What you get in Inception?
• On many projects, if it is more than a week, then the point of inception has been
missed
– It is to decide if the project is worth a serious investigation, not to do that investigation
– Glossary: defines noteworthy terms (encompassed the concept of the data dictionary)
– Business rules (also called Domain rules): (e.g., government tax laws)
(Non-functional requirements)
• Choose to create only those that really add value for the project,
– Drop those if their worth is not proved
Introduction
• NextGen POS, with the flexibility to support
– Varying customer business rules,
Business Case
• Existing POS Products
– Not adaptable to customer's business, in terms of varying business rules.
– None can work in either on-line or off-line mode, dynamically adapting depending on
failures.
– None easily integrate with many third-party systems.
– There is marketplace dissatisfaction with this inflexible state of affairs, and demand for a
POS that rectifies this.
Case study - Inception
Glossary
Term Definition Format Aliases
2. The cashier uses the POS system to record each purchased item.
4. The customer enters payment information, which the system validates and records.
6. The customer receives a receipt from the system and then leaves with the items.
Use case
Information
Flow
Diagrams
Actor
POST
Buy
Items
Cashier Customer
Log In
Use case
Refund System
Purchased boundary
items
Relating Use cases
-
Introduction
• Objective: Relate uses cases with include and extend associations,
may be part of several regular use cases, such as “Process Sale” and “Process Rental”.
• It is an organization mechanism
– To improve communication & comprehension of the use cases,
-
The include Relationship
To separate it into its own subfunction use case, and indicate its inclusion.
– This is simply refactoring and linking text to avoid duplication
Process Sale
Cashier
«include» «include» «actor»
Accounting
«include» System
Handle Returns
Manage Users
...
The include Relationship
Using include with Asynchronous Event Handling
• Asychronous Events
– When a user is able to, at any time, select or branch to a particular window,
function, or Web page, or within a range of steps.
• Basic notation is to use a*, b*, ... style labels in the Extensions section
– To imply an extension or event that can happen at any time.
Using include with Asynchronous Event Handling
Why to use include relationship?
• People who follow “include” have less confusion with their writing than
people who mix include with extend and generalizes [Cockburn01].
Concrete/Abstract Use Cases
– Handle Credit Payment is abstract; it doesn't stand on its own, but is always part of
another story, such as Process Sale.
Base/Addition Use Cases
– Handle Credit Payment is the addition use case in the include relationship to Process
Sale.
• Addition use cases are usually abstract. Base use cases are usually concrete.
The extend Relationship
-
The extend Relationship
– And within it, describe where and under what condition it extends the behavior of some
Extension Points:
Payment UML notation:
VIP Customer 1. The extending use case
points to the base use case.
«extend»
Payment, if Customer 2. The condition and
presents a gift certificate extension point can be
shown on the line.
Handle Gift Certificate
Payment
The extend Relationship
A signature quality of extend relationship is that the base use case (Process Sale)
has no reference to the extending use case (Handle Gift Certificate Payment)
Use of Extension Point
• Step numbering of base use case can change without affecting the
extending use case
– Extension point may simply "At any point in use case X,“
– Refined vision,
– Also not a phase when the models are fully developed in preparation for
implementation (Waterfall)
– Rather, Code and design are production-quality portions of the final system
• Adaptively design, implement, & test the core and risky parts of the
architecture
• Write most of the use cases and other requirements in detail, through a
Use Case
Process Rentals
Feature:
Logging
Iteration 1 of Elaboration Phase
A simple happy path scenario, and the design and implementation to support it.
– Design and implementation of supporting UI, DB, and so forth, would also be done
Planning the Next Iteration
– Risk includes both technical complexity and other factors, such as uncertainty
of effort or usability.
– Coverage implies that all major parts of the system are at least touched on in
components.
Low … …
Domain Model
A visual representation of
conceptual classes or real situation objects
in a domain
Definition
• Guidelines
– Avoid a waterfall-mindset (big-modeling effort to make "correct" domain model)
Provides a Conceptual Perspective
– Responsibilities or methods.
Domain Model 2
A domain model shows real-situation conceptual classes, not software
classes
visualization of a real-world concept in
Sale the domain of interest
Sale
void software class; not part
a date of domain model
time
print()
POS Domain Model
concept Sales
Item
or domain LineItem Records-sale-of
object 1
quantity 0..1
1..* *
Stocked-in
association Contained-in
1 1
Sale Store
1 Register
Captured-on
Payment
1
amount
Conceptual Class
• A conceptual class is an idea, thing, or object.
– Symbol words or images representing a conceptual class.
• Example of Intension:,
– Customer may be a person or organization that purchases goods or services
• Example of Extension:
– Set of all objects to which the concept applies, e.g. the Customer may be “ John”, Tom”
Domain Model 4
Sale concept's symbol
date
time
sale-1
sale-4
Domain Models and Decomposition
Sale
A Payment in the Domain Model Payment 1
1 Pays-for
is a concept, but a Payment in date
the Design Model is a software amount
time
class. They are not the same
thing, but the former inspired the
inspires
naming and definition of the
objects
latter.
and
names in
This reduces the representational
gap.
Sale
This is one of the big ideas in Payment
object technology. 1 1 date: Date
Pays-for
amount: Money startTime: Time
UP Design Model
The object-oriented developer has taken inspiration from the real world domain
in creating software classes.
-
Aggregation
• Definition :
– A special form of association that specifies a whole-part relationship between
the aggregate (whole) and a component part.
Example:
A Library contains students and books.
Relationship b/w library and student is aggregation.
Aggregation
• Aggregation is shown in UML with a hollow diamond symbol,
– At the composite end of a whole-part association
• Example:
– A Library contains students and books.
Library Students
Example:
A Library contains students and books.
Relationship between library and book is composition.
A student can exist without a library and therefore it is aggregation.
A book cannot exist without a library and therefore its a composition.
Composition
• Aggregation is shown in UML with a filled diamond symbol,
– At the composite end of a whole-part association
• For instance,
– Physical assemblies are organized in aggregation relationships,
such as a Hand aggregates Fingers.
Aggregation Vs Composition
2. The part must always belong to a composite (no free-floating Fingers) and
3. The composite is responsible for the creation and deletion of its parts either by
– Related to this constraint is that if the composite is destroyed, its parts must either be
• For example,
– If a physical paper Monopoly game board is destroyed, we think of the squares as being
– Likewise, if a software Board object is destroyed, its software Square objects are
• Guidelines:
1. On composition : If in doubt, leave it out
3. Some properties of the composite propagate to the parts, such as the location.
Benefits
1. Operations such as copy & delete applied to whole often propagate to the
parts.
Composition in NextGen Domain Model
• In the POS domain,
– “SalesLineItems” may be considered a part of a complete “sale”
• In general,
– Transaction line items are viewed as parts of an aggregate transaction.
Sale SalesLineItem
1 1..*
Product Product
Catalog 1 1..* Description
• By similar justification
– “ProductCatalog” is a composite of “ProductDescriptions”
Associations
67
Associations
association
Records-current
Register Sale
1 1
Fig 1.Associations
68
Useful Associations
69
UML Association Notation
70
UML Association Notation
- “reading direction arrow”
- it has no meaning except to
indicate direction of reading the
association label
- often excluded
Records-current
Register Sale
1 1
71
Finding Associations-
Common Associations List
The common categories that are worth
considering are:
• A is a physical part of B . Eg: Wing-Airplane
• A is a logical part of B. Eg: SalesLineItem-
Sale.
• A is physically contained in B . Eg: Register-
Store.
72
Common Associations List 2
• A is logically contained in B.
Eg:ItemDescription-Catalog.
• A is a description of B.Eg:ItemDescription-
Item.
• A is a line item of a transaction or report
B.Eg:SalesLineItem-Sale.
• A is a member of B .Eg: Cashier-Store.
• A uses or manages B.Eg:Cashier-Register.
73
Common Associations List 3
• A is
known/logged/recorded/reported/captured
in B.Eg: Sale-Register.
• A is an organizational subunit of B .
Eg:Department-Store.
• A communicates with B. Eg:Customer-
Cashier.
• A is next to B. Eg:City-City.
74
Common Associations List 4
• A is related to a transaction B. Eg:
Customer-Payment.
• A is a transaction related to another
transaction B. Eg:Payment-Sale.
• A is next to B. Eg:City-City.
• A is owned by B. Eg:Register-Store.
• A is an event related to B. Eg:Sale-Customer.
75
High-Priority Associations
• A is a physical or logical part of B.
• A is physically or logically contained in/on
B.
• A is recorded in B.
76
Associations Guidelines
• The knowledge of the relationship needs
to be preserved for some duration.
• Identifying conceptual classes is more
important than identifying associations.
• Avoid showing redundant or derivable
associations.
77
Roles
• Each end of an association is called a
role.
• Roles may have
– name
– multiplicity expression
– Navigability(know about each other)
78
Multiplicity
• Multiplicity defines the number of
instances of a class A ,that can be
associated with one instance of class B,at
a particular moment.
• Eg: In countries with monogamy laws,a
person can be married to 1 person at any
particular time.But over a span of time one
person can be married to many persons.
79
Multiplicity
Stocks
Store Item
1 *
multiplicity of the
role
1..*
T one or more;
1..40
T one to 40
5
T exactly 5
3,5,8
T exactly 3,5 or 8
82
Associations Names
Store
1
Contains
1..*
Register Captures Sale Paid-by Payment
1 1..* 1 1
Airline
1
Employs
1..*
Person Assigned-to Flight Assigned-to Plane
1 * * 1
1 *
Supervises
84
Multiple Associations
Flies-to
* 1
Flight Airport
* Flies-from 1
85
Implementation
• The domain model can be updated to
reflect the newly discovered associations.
• But,avoid updating any documentation or
model unless there is a concrete
justification for future use.
• Defer design considerations so that
extraneous information is not included and
maximizing design options later on.
86
Cleaning Associations 1
• Do not overwhelm the domain model with
associations that are not strongly required.
• Use need-to-know criterion for maintaining
associations.
• Deleting associations that are not strictly
demanded on a need-to-know basis can
create a model that misses the point.
87
Cleaning Associations 2
• Add comprehension-only associations to
enrich critical understanding of the
domain.
88
A partial domain model Records-sale-of
Described-by
1
Product Product
Catalog Specfication
Contains
1 1..*
1 Describes
Used-by
0..1 * * *
Sales Store Item
LineItem
1 Stocks
1 * 1..*
1..* Logs- 1
completed
Contained-in Houses
1 1..*
Sale * Register Manager
Captured-on Started-by
1 1 1
1
1 1 1
Records-sales-on
Paid-by
1
Initiated-by
Cashier
Initiated-by 1
1 1
Payment Customer
89
Without need-to-know
associations
Records-sale-of
Described-by
1
Product Product
Catalog Specfication
Contains
1 1..*
1 Describes
Used-by
0..1 * * *
Sales Store Item
LineItem
1 Stocks
1 * 1..*
1..* Logs- 1
completed
Contained-in Houses
1 1..*
Sale * Register
Captured-on
1 1
1
1 1
Records-sales-on
Paid-by
1
Initiated-by
Cashier
1
1
Payment
90
Conclusion
• When in doubt if the concept is
required,keep the concept.
• When in doubt if the the association is
required,drop it.
• Do not keep derivable association.
91