Você está na página 1de 31

Domain Model

lecture 13-17, chitkara university


What is a Domain Model?

A important types of objects in the context of the business.


The domain model represents the ‘things’ that exist or
events that transpire in the business environment.

lecture 13-17, chitkara university


Why do a domain model?

 Gives a conceptual framework of the things in the problem


space
 Helps you think – focus on semantics
 Provides a glossary of terms – noun based
 It is a static view - meaning it allows us convey time invariant
business rules
 Foundation for use case/workflow modelling
 Based on the defined structure, we can describe the state of
the problem domain at any time.

lecture 13-17, chitkara university


Simple domain model

lecture 13-17, chitkara university


Features of a domain model
The following features enable us to express time invariant
static business rules for a domain:-
 Domain classes – each domain class denotes a type of object.  
 Attributes – an attribute is the description of a named slot of a specified
type in a domain class; each instance of the class separately holds a value.
 
 Associations – an association is a relationship between two (or more)
domain classes that describes links between their object instances.
Associations can have roles, describing the multiplicity and participation
of a class in the relationship.
 Additional rules – complex rules that cannot be shown with symbology
can be shown with attached notes.

lecture 13-17, chitkara university


How do I make a domain model?
Perform the following in very short iterations:
 Make a list of candidate domain classes.
 Draw these classes in a UML class diagram.
 If possible, add brief descriptions for the classes.
 Identify any associations that are necessary.
 Decide if some domain classes are really just attributes.
 Where helpful, identify role names and multiplicity for
associations.
 Add any additional static rules as UML notes that cannot be
conveyed with UML symbols.
 Group diagrams/domain classes by category into packages.
Concentrate more on just identifying domain classes in early
iterations !

lecture 13-17, chitkara university


How to Find Conceptual Classes?

Three Strategies to Find Conceptual Classes?


1. Reuse or modify existing models.
2. Use a category list.
3. Identify noun phrases.

lecture 13-17, chitkara university


Method 2: Use a Category List

We can create a domain model by making a list of candidate


conceptual classes which contains many common categories
with an emphasis on business information system needs.

lecture 13-17, chitkara university


Use a category list Cont….
Case Study: Airline Reservation Domain
Conceptual Class Category Examples

product or service related to a transaction or Item, Flight, Seat, Meal


transaction line item

where is the transaction recorded? Register, Ledger, Flight Manifest

roles of people or organizations related to the Cashier, Customer, Passenger, Airline


transaction; actors in the use case

place of transaction; place of service Store, Airport, Plane, Seat

physical objects Item, Register Board, Piece, Die Airplane

descriptions of things Product Description, Flight Description

lecture 13-17, chitkara university


Method 3: Finding Conceptual Classes with
Noun Phrase Identification

Another useful technique (because of its simplicity)


suggested is linguistic analysis: Identify the nouns and
noun phrases in textual descriptions of a domain, and
consider them as candidate conceptual classes or
attributes.

lecture 13-17, chitkara university


Identify noun phrases
Case Study: POS Domain
1. Customer arrives at a POS checkout with goods and/or
services to purchase.
2. Cashier starts a new sale.
3. Cashier enters item identifier.
4. System records sale line item and presents item description,
price, and running total. Price calculated from a set of price
rules.

lecture 13-17, chitkara university


What are Conceptual Classes?

The domain model illustrates conceptual classes or vocabulary


in the domain. Informally, a conceptual class is an idea, thing,
or object. More formally, a conceptual class may be
considered in terms of its symbol, intension, and extension
1. Symbol words or images representing a conceptual class.
2. Intension the definition of a conceptual class.
3. Extension the set of examples to which the conceptual class
applies.

lecture 13-17, chitkara university


A conceptual class has a symbol, intension,
and extension

lecture 13-17, chitkara university


Example: Find and Draw Conceptual Classes

 Case Study: POS Domain


 From the category list and noun phrase analysis, a list is
generated of candidate conceptual classes for the domain. On
the basis of category list guidelines that emphasize business
transactions and their relationship with other things. The list
is constrained to the requirements which is under
consideration for scenario of Process of Sale.

lecture 13-17, chitkara university


Example: Find and Draw Conceptual Classes
Case Study:POS Domain

 Sale
 Cashier
 CashPayment
 Customer
 SalesLineItem
 Store
 Item
 ProductDescription
 Register
 ProductCatalog
 Ledger
lecture 13-17, chitkara university
Initial POS domain model

lecture 13-17, chitkara university


How to Model the Unreal World?

 Some software systems are for domains that find very little
analogy in natural or business domains;
› software for telecommunications is an example.
 It is still possible to create a domain model in these domains,
but it requires a high degree of abstraction and stepping back
from familiar designs.
 For example, here are some candidate conceptual classes
related to a telecommunication switch:
› Message, Connection, Port, Dialog, Route, Protocol.

lecture 13-17, chitkara university


A Common Mistake with Attributes vs.
Classes

The most common mistake when creating a domain model is to


represent something as an attribute when it should have been
a conceptual class.
 Guideline

If we do not think of some conceptual class X as a number or


text in the real world, X is probably a conceptual class, not an
attribute.

lecture 13-17, chitkara university


A Common Mistake with Attributes vs.
Classes cont. with example

In the real world, a store is not considered a number or text the term suggests a legal entity, an
organization, and something that occupies space. Therefore, Store should be a conceptual class.
As another example, consider the domain of airline reservations. Should destination be an
attribute of Flight, or a separate conceptual class Airport?

In the real world, a destination airport is not considered a number or text it is a massive
thing that occupies space. Therefore, Airport should be a concept.

lecture 13-17, chitkara university


Model with 'Description' Classes

A description class contains information that describes


something else. For example, a ProductDescription that
records the price, picture, and text description of an Item.

lecture 13-17, chitkara university


Why Use 'Description' Classes?

1. An Item instance represents a physical item in a store; as


such, it may even have a serial number.
2. An Item has a description, price, and itemID, which are not
recorded anywhere else.
3. Everyone working in the store has amnesia.
4. Every time a real physical item is sold, a corresponding
software instance of Item is deleted from "software land."

lecture 13-17, chitkara university


Descriptions about other things
The * means a multiplicity of "many." It indicates that one
Product Description may describe many (*) Items.

lecture 13-17, chitkara university


Descriptions in the Airline Domain

lecture 13-17, chitkara university


How to Create a Domain Model?

Bounded by the current iteration requirements under design:


1. Find the conceptual classes (see a following guideline).
2. Draw them as classes in a UML class diagram.
3. Add associations and attributes.

lecture 13-17, chitkara university


Attributes

An attribute is a logical data value of an object. It is


useful to identify those attributes of conceptual classes
that are needed to satisfy the information requirements of
the current scenarios under development.

lecture 13-17, chitkara university


Identifying attributes ?

A domain class sounds like an attribute if: -


 It relies on an associated class for it’s identity – e.g. ‘order
number’ class associated to an ‘order’ class. The ‘order
number’ sounds suspiciously like an attribute of ‘order’.
 It is a simple data type – e.g. ‘order number’ is a simple
integer. Now it really sounds like an attribute!

lecture 13-17, chitkara university


Associations
 An association is a relationship between classes (more
precisely, instances of those classes) that indicates some
meaningful and interesting connection.

lecture 13-17, chitkara university


The UML notation for associations

lecture 13-17, chitkara university


Applying UML: Attribute Notation

lecture 13-17, chitkara university


Multiplicity
 Multiplicity defines how many instances of a class A can be
associated with one instance of a class B.

Multiplicity on association

lecture 13-17, chitkara university


Multiplicity values

lecture 13-17, chitkara university

Você também pode gostar