domain model a representation of real-world conceptual classes in a problem domain. the core of...

28
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

Upload: james-ramsey

Post on 06-Jan-2018

216 views

Category:

Documents


0 download

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 experts

TRANSCRIPT

Page 1: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 2: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 3: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 4: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 5: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

Noun Phrases

• Identify noun phrases in use-case model • Some are classes, others are attributes

StoreRegister SaleItem

CashPayment

SalesLineItem Cashier Customer

ProductCatalog

ProductDescription

Ledger

Page 6: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 7: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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)

Page 8: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

Classes vs. Attributes

Sale

Store

Sale Store

Phone no

Flight

destination

Flight Airport

name

Or ?

Or ?

Page 9: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 10: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

Specification Conceptual Class

Item

descriptionpriceserial numberitemID

ProductDescription

descriptionpriceitemID

Item

serial number

Describes Better

Worse

1 *

Page 11: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 12: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 13: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 14: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 15: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 16: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 17: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 18: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 19: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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)

Page 20: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 21: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 22: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 23: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 24: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

Use-Case

Use abstract events names:

•enterItem (itemID, quantity)

•Scan (itemID, quantity)

Page 25: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 26: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 27: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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

Page 28: Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects

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