domain model a representation of real-world conceptual classes in a problem domain. the core of...
DESCRIPTION
Domain Model A major distinction between object- oriented and structured analysis is: division by conceptual classes (objects) rather than division by functions To identify conceptual classes: –Use a conceptual Class category list –Identify noun phrases –Use analysis patterns done by expertsTRANSCRIPT
Domain Model• A representation of real-world conceptual
classes in a problem domain. • The core of object-oriented analysis• They are NOT software objects• Created during the elaboration stage• Illustrated as a set of class diagrams
without operations– Conceptual classes– Associations between conceptual classes– Attributes of conceptual classes
Conceptual Model Example
Register
Item
Store
addressname
Sale
date time
Payment
amount
SalesLineItem
quantity
Stocked-in
*
Houses
1..*
Contained-in
1..*
Records-sale-of
0..1
Paid-by
1
1
1
1
1
1
0..1
1
Captured-on
conceptor domain object
association
attributes
Domain Model
• A major distinction between object-oriented and structured analysis is: division by conceptual classes (objects) rather than division by functions
• To identify conceptual classes:– Use a conceptual Class category list– Identify noun phrases– Use analysis patterns done by experts
Conceptual Class Category ListPhysical or tangible objects Events
Specifications, design or description of things
Rules and policies
Places Abstract noun concepts
Transactions/transaction line items Catalogs
Roles of people Records of finance
Containers of things Manuals, books, documents
Things in a container Organizations
Other computer/ electromechanical systems
Noun Phrases
• Identify noun phrases in use-case model • Some are classes, others are attributes
StoreRegister SaleItem
CashPayment
SalesLineItem Cashier Customer
ProductCatalog
ProductDescription
Ledger
Steps to Create Domain Model
• List conceptual classes identified• Draw them in a domain model• Add associations necessary to record
relationship between classes• Add attributes to fulfill requirements
Domain Model Guidelines
• Use the vocabulary of the domain when naming the conceptual classes
• Exclude conceptual classes that are not relevant to the requirements
• Do not include things that are not there in real life
• Conceptual classes are more complex than a number or text (otherwise attribute)
Classes vs. Attributes
Sale
Store
Sale Store
Phone no
Flight
destination
Flight Airport
name
Or ?
Or ?
Specification Conceptual Class
• There is a need to include specification/ description classes that include information about items.
• Used in sales, product and manufacturing domains to include description of a thing
• When all inventory items of a specific product has been sold and the item instance class is deleted, the specification class still remains
Specification Conceptual Class
Item
descriptionpriceserial numberitemID
ProductDescription
descriptionpriceitemID
Item
serial number
Describes Better
Worse
1 *
Specification Conceptual Class
• Use specification conceptual classes when:– There is a need for a description of the item
independent of the current existence of these items in the system
– Deleting instances of things (e.g. items) will result in loss of information that needs to be maintained
– Reduce redundant information
UML vs. Models
• UML describes raw diagram types• Models utilize UML diagrams in certain
context.• For example:
– UML has class diagram (rectangular box)– In Domain model, they are real life conceptual
classes– In Design model, they are software classes
Associations• A relationship between types (instances of
types) that indicates some meaningful and interesting connection
• UML definition: a semantic relationship between two or more classifiers that involve connection among their instances.
• Include associations when:– Knowledge of relationship needs to be stored
for some time– Use “Common association list” to decide
Associations• Lines between classes with association
name on it.
• End points of the line has multiplicity expression indicating numerical relationship between instances of classes
• Default reading direction is left to right, and top to bottom. Or optional reading arrow
• Multiplicity: how many instances of class A can be associated with one instance of class B
Multiplicity Valueszero or more; "many"
one or more
one to 40
exactly 5
T
T
T
T
*
1..*
1..40
5
T3, 5, 8
exactly 3, 5, or 8
Common Association ListA is a physical part of B A is a member of B
A is a logical part of B A is an organizational subunit of B
A is physically / logically contained in B
A is next to B
A is recorded/ logged in B A is an event related to B
A is a description of B A is related to a transaction B
A is a line item of report or transaction
A is owned by B
A uses or manages B A communicates with B
Associations
• It is more important to find conceptual classes than to find associations
• You can have multiple associations between two classes
• Show only important associations
Flight Airport
Flies-to
Flies-from
*
* 1
1
Attributes• A logical data value of an object
• Include attributes in the domain model that the requirements imply to store
• Optionally show the type of the attribute
• Attribute data type should be simple (e.g. string, date, number, boolean)
• If the attribute is not simple, it should be a conceptual class
Attributes
Cashier
namecurrentRegister
Cashier
name
Register
number
Uses
Worse
Better
not a "data type" attribute
1 1
• Relate classes using association NOT attributes (No foreign keys)
Quantities and Units
• Most numeric values have units (e.g. money, weight, length)
• For international software, these quantities should be recorded with their units
• Units are conceptual classes, but it is acceptable to collapse them into data types because they are common
Quantities and UnitsPayment
amount : Number
Payment Quantity
amount : Number
Unit
...
Payment
amount : Quantity
Has-amount1*
Is-in1*
not useful
quantities are pure data values, so are suitable to show in attribute section better
Payment
amount : Money
variation: Money is a specialized Quantity whose unit is a currency
System Sequence Diagram• A picture that shows for a particular use-case
scenario, events that external actors generate, their order and inter-system events.
• Shows input/ output events related to system being described
• The system is treated as a black box
• SSD should be drawn for the main success scenario of the use-case
• Created during the elaboration stage• System events may include parameters
SSD Example
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
Use-Case
Use abstract events names:
•enterItem (itemID, quantity)
•Scan (itemID, quantity)
Contracts• Describes detailed system behavior in
terms of state changes of objects in the Domain model after a system operation has been executed
• Done for each complex operation in the System Sequence diagram
• Operation: a specification of a transformation or query that an object may be called to execute
• Writing contracts may suggest changes in the domain model
Contracts Sections• Operation: name of the operation and
parameters• Cross reference: Use case this operation can
occur within• Preconditions: Assumptions about the state of
the system or objects in the domain model before the execution of the operation
• Post conditions: The state of objects in the domain model after the completion of the operation
Contracts• Post conditions: (results)
– Instance creation/ deletion– Changes in attributes– Associations broken or formed
• Steps to write contracts– Identify system operation for SSD– If things are complex and need details – Write contract
Contracts
• Describe real life operations which could be paper-based, not a computer freeing memory
• Example:In many countries, after a person has declared
bankruptcy and seven or ten years have passed, all records of their bankruptcy declaration must be destroyed