repetition af domæne model. artifact influence emphasizing the domain model
TRANSCRIPT
Repetition af Domæne 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
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.
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
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
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)
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)
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
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
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
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
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
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.
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
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
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
Modeling Generalizationclass set membership
“100%” rule
Payment
CashPayment CreditPayment CheckPayment
Modeling Generalizationsubclass conformance
“Is-a” rule
CashPayment
CreditPayment
CheckPayment
Payment
amount : MoneySalePays-for
11
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
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
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)
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
Association Classesexamples
salary
Employment
EmploysCompany Person**
dateOfIncarceration
JailTerm
IncarceratesJail Person*
Married-to
Person
0..10..1
1
a person may haveemployment with severalcompanies
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)
Aggregation and composition
Finger0..7
Hand1
aggregation diamond
Finger0..7
Hand
composite aggregation
1
UMLElementReferencesUMLPackage
shared aggregation
**
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
Aggregation and composition
SalesLineItemSale1..*
ProductSpecification
ProductCatalog 1..*
1
1
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
Derived elements
date/totaltime
Sale
derived attribute
SalesLineItem1..*
Sale
/quantity
derivable from theactual multiplicity
1
Packages- POS Domain Model
Domain
Core/Misc Payments Products Sales
AuthorizationTransactions