repetition af domæne model. artifact influence emphasizing the domain model

30
Repetition af Domæne model

Upload: joshua-chase

Post on 14-Dec-2015

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Repetition af Domæne model

Page 2: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Artifact influence emphasizing the Domain Model

Glossary

SoftwareArchitecture Doc.

DomainModel

Requirements

ProjectManagement

BusinessModeling

Design

Sample UP Artifacts Partial artifacts,refined in each

iteration.

Test

TestPlan

SoftwareDev. Plan

. . .

Use-Case Model

textuse

cases

:System

foo( x )

systemoperationcontracts

systemsequencediagrams

terms, conceptsattributes,associations

state changes indomain objects,attributes,associations

elaboration ofsome terms inthe domainmodel

software classes inthe domain layer ofthe design takeinspiration from thenames, attributes,and associations inthe domain model

bar( y )

usecase

diagrams

**

Design Model

Environment

DevelopmentCase

Page 3: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Domain Model

• The Domain Model is the most important artifact to create during object oriented analysis – (a visual dictionary)

• The domain model is a representation of real-world conceptual classes NOT of software components

• The domain model is used as a source of inspiration for designing software objects.

Page 4: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Domain Model

Register

Item

Store

addressname

Sale

datetime

Payment

amount

SalesLineItem

quantity

Stocked-in

*

Houses

1..*

Contained-in

1..*

Records-sale-of

0..1

Paid-by

1

1

1

1

1

1

1

1

Captured-on

conceptor domainobject

association

attributes

Page 5: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Domain Modelguideline

• It is better to overspecify a domain model with lots of fine-grained conceptual classes than to underspecify it !

• A Domain Model is not absolutely correct or wrong, but more or less useful, it is a tool of communication

Page 6: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Domain Modelstrategies to identify conceptual classes

• Use a conceptual class category list (p 134-135) list of candidate conceptual classes

• Identify noun phrases based upon fully dressed use cases (p 135-136)

• (Use analysis patterns)

Page 7: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Domain Model Candidate conceptual classes for the Sales Domain:

• Receipt???– Report of a sale – duplicates information

found elsewhere exclude receipt– Special role in terms of business rules (the

right to return bought items) include it (since returns are not considered in this iteration, receipt is excluded)

Page 8: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Domain ModelModeling guidelines

1. List the candidate conceptual classes using CCC-List and noun phrase identification technique related to the current requirements under consideration

2. Draw them in a domain model3. Add the associations necessary to record

relationships for which there is a need to preserve some memory

4. Add the attributes necessary to fulfill the information requirements

Page 9: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Domain Modelassociations

• An association is a relationship between types (or more specifically, instances of those types) that indicates some meaningful and interesting connection

SaleRegisterRecords-current

1 1

association

Page 10: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Domain ModelFinding associations

• Common Associations List (p 156-157)

• High-Priority Associations:– A is a physical part of B– A is physically or logically contained in B– A is recorded in B

Page 11: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Domain ModelAssociation guidelines

• Focus on those associations for which knowledge of the relationship needs to be preserved for some duration (”need to know” associations)

• It is more important to identify conceptual classes than to identify associations

• Too many associations tend to confuse the domain model rather than illuminate it. Their discovery can be time-consuming, with marginal effect

• Avoid showing redundant or derivable associations

Page 12: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

NextGen POS Domain ModelAssociations

Register

ItemStore

Sale

Payment

SalesLineItem

CashierCustomer

Manager

ProductCatalog

ProductSpecification

Stocks

*

Houses

1..*

Used-by

*

Contains

1..*

Describes

*

Captured-on

Contained-in

1..*

Described-by

*

Records-sale-of

0..1

Started-by

Paid-by Initiated-by

Logs-completed

*

Records-sales-on

1

1

1

1

1

1..*

11

1

1

1

1

1

1

1

1 1

1

Initiated-by

1

1

Page 13: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Attributes

• Attribute = a logical data value of an object.

• Include the following attributes in a domain model : – Those for which the requirements (ex. Use

cases) suggest or imply a need to remember information.

– Ex. A receipt normally has a date and time.

Page 14: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Valid attribute types

• Keep it simple– Prefer simple

attributes or data types• Boolean, Date,

Number, String….

• Relate conceptual classes with an association– not with an attribute

Cashier

namecurrentRegister

Cashier

name

Register

number

Uses

Worse

Better

not a "simple" attribute

1 1

Flight

Flight

destinationWorse

BetterFlies-to Airport1 1

destination is a complexconcept

Page 15: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

A partial domain model

Register

ItemStore

addressname

Sale

date

time

Pay ment

amount

SalesLineItem

quantity

CashierCustomer

Manager

ProductCatalog

ProductSpecif ication

descriptionpriceitemID

Stocks

*

Houses

1..*

Used-by

*

Contains

1..*

Describes

*

Captured-on

Contained-in

1..*

Described-by

*

Records-sale-of

0..1

Started-by

Paid-by Initiated-by

Logs-completed

*

Records-sales-on

1

1

1

1

1

1..*

11

1

1

1

1

1

1

1

1 1

1

Page 16: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Modeling Generalization

• A conceptual superclass definition is more general or encompassing than a subclass definition

• Identify domain superclasses and subclasses relevant to the current investigation, and illustrate them in the Domain Modelc

Page 17: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Modeling Generalizationclass set membership

“100%” rule

Payment

CashPayment CreditPayment CheckPayment

Page 18: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Modeling Generalizationsubclass conformance

“Is-a” rule

CashPayment

CreditPayment

CheckPayment

Payment

amount : MoneySalePays-for

11

Page 19: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

When to define conceptual subclasses?

• Create a conceptual subclass of a superclass when: (see also page 402)

– The subclass has additional attributes of interest– The subclass has additional associations of interest– The subclass concept is operated on, handled,

reacted to or manipulated differently than the superclass or other subclasses, in ways that are of interest

– The subclass concept represents an animate thing that behaves differently than the superclass or other subclasses, in ways that are of interest

Page 20: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

When to define a conceptual superclass?

• Create a conceptual superclass in a generalization relationship to subclasses when:– The potential conceptual superclass represents

variations of a similar concept– The subclasses will conform to the ”100%” and ”Is-a”

rules– All subclasses have the same attribute which can be

factored out and expressed in the superclass– All subclasses have the same association which can

be factored out and related to the superclass

Page 21: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Abstract Conceptual Classes

• If all members of a class C must also be member of a subclass, the class C is called an abstract conceptual class

Payment

CashPayment CreditPayment CheckPayment

Payment

CashPayment CreditPayment CheckPayment

If a Payment instance mayexist which is not aCashPayment, CreditPaymentor CheckPayment, thenPayment is not an abstractconceptual class.

Payment is an abstractconceptual class. A Paymentinstance must conform to oneof the subclasses:CashPayment, CreditPaymentor CheckPayment.

abstract conceptual class

(a)

(b)

Page 22: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Association Classes

• Guidelines for adding association classes:

– An attribute is related to an association– Instances of the association class have a life-time

dependency on the association– There is a many-to-many association between two

concepts, and information associated with the association itself

Page 23: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Association Classesexamples

salary

Employment

EmploysCompany Person**

dateOfIncarceration

JailTerm

IncarceratesJail Person*

Married-to

Person

0..10..1

1

a person may haveemployment with severalcompanies

Page 24: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Aggregation and composition

• Aggregation is a kind of association used to model whole-part relationships between things. The whole is called the composite

• Two types:– Composite aggregation – (filled diamond)– Shared aggregation – (hollow diamond)

Page 25: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Aggregation and composition

Finger0..7

Hand1

aggregation diamond

Finger0..7

Hand

composite aggregation

1

UMLElementReferencesUMLPackage

shared aggregation

**

Page 26: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Aggregation and composition

• How to identify aggregation:– If in doubt, leave it out

• Consider showing aggregation when:– The lifetime of the part is bound within the lifetime of

the composite – there is a create-delete dependency of the part on the whole

– There is an obvious whole-part physical or logical assembly

– Some properties of the composite propagate to the parts, such as the location

– Operations applied to the composite propagate to the parts, such as destruction, movement, recording

Page 27: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Aggregation and composition

SalesLineItemSale1..*

ProductSpecification

ProductCatalog 1..*

1

1

Page 28: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Roles as concepts vs. roles in associations

Store PersonEmploys-to-handle-salescashier

Employs-to-manage

manager

**

Manages

*workermanager

Store

Cashier

ManagerEmploys *

Employs *

roles as concepts

Manages

*

roles in associations

1

1

1

1 1

Page 29: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Derived elements

date/totaltime

Sale

derived attribute

SalesLineItem1..*

Sale

/quantity

derivable from theactual multiplicity

1

Page 30: Repetition af Domæne model. Artifact influence emphasizing the Domain Model

Packages- POS Domain Model

Domain

Core/Misc Payments Products Sales

AuthorizationTransactions