Presentation is loading. Please wait.

Presentation is loading. Please wait.

What is a domain model? “A domain model captures the most important types of objects in the context of the business. The domain model represents the ‘things’

Similar presentations


Presentation on theme: "What is a domain model? “A domain model captures the most important types of objects in the context of the business. The domain model represents the ‘things’"— Presentation transcript:

1 What is a domain model? “A domain model captures the most 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.” – I. Jacobsen A domain model is a visual representation of conceptual classes or real-situation objects in a domain . Domain models have also been called conceptual models

2 Domain Objects Are Not Software Objects
The term “Domain Model” means a representation of real-situation conceptual classes, not of software objects.

3 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 Based on the defined structure, we can describe the state of the problem domain at any time.

4 Simple domain model Attribute Association Role Domain class

5 EXAMPLE: Partial Domain model
use cases sys. sequence diagrams domain models operation contract 5

6 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.

7 Domain classes? Each domain class denotes a type of object. It is a descriptor for a set of things that share common features. Classes can be:- Business objects - represent things that are manipulated in the business e.g. Order. Real world objects – things that the business keeps track of e.g. Contact, Site. Events that transpire - e.g. sale and payment. A domain class has attributes and associations with other classes (discussed below). It is important that a domain class is given a good description

8 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 !

9 Identifying domain classes?
Three ways in which you can indentify a domain class. Reuse or modify existing models. Use category list. Identify nouns and phrases in textual descriptions of a domain. Consider a use case description as follows:- 1.      Customer arrives at a checkout with goods and/or services to purchase. 2.      Cashier starts a new sale. 3.      Cashier enters item identifier. 4.      System records the sale line item and presents the item description, price and running total.

10

11

12

13 Identifying nouns as candidates for domain objects

14 Candidate Conceptual Classes: Process Sale, Iteration 1

15 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!

16 Attributes vs. Classes Should “something” be Examples: Guideline:
an attribute of a class, or a separate conceptual class Examples: Store: An attribute of Sale or separate class Store: Not a number or text Should be separate conceptual class Flight destination: An attribute or a separate class Destination is an airport, not a number Guideline: If we thing of something as simply a number or text in real life, it should be an attribute. Otherwise it should be a conceptual class.

17 UML: Associations 17

18 How to name an association?
Pattern: Class name – verb phrase – class name Readable and meaningful Try to avoid “has” or “uses”. These give no extra information

19 UML: Multiplicity 19

20 Example

21

22 Domain Model- POS Example: From the Conceptual Class Category List and noun phrase analysis, a list is generated of candidate conceptual classes for the domain. Register Product Specification Store Cashier Customer SalesLineItem Manager ProductCatalog Item Payment Sale

23 Apply the following steps to create a domain model
1. List the candidate conceptual classes using the Conceptual Class Category List and noun phrase identification techniques related to the current requirements under consideration. 2. Draw them in a domain model. 3. Add the associations necessary to record relationships . 4. Add the attributes necessary to fulfill the information requirements.

24 Initial Domain Model

25 Domain Model: Adding Associations
An association is a relationship between types (or more specifically, instances of those types) that indicates some meaningful and interesting connection

26 Association 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 association Too many associations tend to confuse a domain model rather than illuminate it. Their discovery can be time-consuming, with marginal benefit. Avoid showing redundant or derivable associations. Name an association based on a TypeName-VerbPhrase-TypeName format where the verb phrase creates a sequence that is readable and meaningful in the model context.

27 Roles Each end of an association is called a role. Roles may optionally have: name multiplicity expression navigability

28 POS Domain Model Associations

29 Domain Model: Adding Attributes
An attribute is a logical data value of an object. No Attributes as Foreign Keys Attributes should not be used to relate conceptual classes in the domain model

30 Example

31 Attributes in the POS Domain Model
Payment amount— To determine if sufficient payment was provided, and to calculate change, an amount (also known as "amount tendered") must be captured. Product-Specification description— To show the description on a display or receipt. id— To look up a ProductSpecification, given an entered itemID, it is necessary to relate them to a id. price— To calculate the sales total, and show the line item price. Sale date, time— A receipt is a paper report of a sale. It normally shows date and time of sale. SalesLineItem quantity— To record the quantity entered, when there is more than one item in a line item sale (for example, five packages of tofu). Store address, name— The receipt requires the name and address of the store.

32 Domain Model Conclusion

33 References “Business Modelling with UML” – Penker
“Analysis patterns” – Fowler Applying UML and Patterns – Craig Larman These books provide patterns for domain models.


Download ppt "What is a domain model? “A domain model captures the most important types of objects in the context of the business. The domain model represents the ‘things’"

Similar presentations


Ads by Google