Presentation is loading. Please wait.

Presentation is loading. Please wait.

Domain Model: Visualizing Concepts

Similar presentations


Presentation on theme: "Domain Model: Visualizing Concepts"— Presentation transcript:

1 Domain Model: Visualizing Concepts
Ch. 9

2 Domain Models A Domain Model illustrates meaningful concepts in a problem domain. Does a domain model represent real things or SW components? Is a domain model static or interactive? It may show: concepts associations between concepts attributes of concepts Avoid Analysis Paralysis! Domain Model <> Class Diagram! DM: representation of real-situation conceptual classes not of sw objects == Visual dictionary, shows abstraction of conceptial classes

3 Domain Models A Domain Model is a description of things in the real world. A Domain Model is not a description of the software design. What is a concept? Item Store * 1 address name Stocked-in

4 Conceptual Classes in the Sale Domain
What is the distinction between OO and structured analysis? Store POS Sale Partial Domain Model. Symbol: words or image Intention: definition Extension: examples to which conceptual class applies

5 Strategies to Identify Conceptual Classes
Use a conceptual class category list. Use noun phrase identification. Why create domain model? Domain layer supports a mental layer between our mental model of the domain, lower representation gap with OO, DM inspires objects and names in OO, reduce representational gap: use actual objects and definitions to inspire coding objects and class blueprints

6 Use a conceptual class category list
Concept Category Example Physical or tangible objects POS Specifications, designs, or descriptions of things ProductSpecification Places Store Transactions Sale, Payment Transaction line items SalesLineItem Roles of people Cashier Containers of other things Store, Bin (See complete list in Larman 2nd. ed., pp )

7 Finding Conceptual Classes with Noun Phrase Identification
1. This use case begins when a Customer arrives at a POS checkout with items to purchase. 2. The Cashier starts a new sale. 3. Cashier enters item identifier. How to: find nouns, draw as classes, add associations, attributes Do not reinvent the wheel

8 The Need for Specification or Description Conceptual Classes
What is wrong with this picture? Consider the case where all items are sold, and thus deleted from the computer memory. How much does an item cost? Item description price serial number itemID

9 The Need for Specification or Description Conceptual Classes
The memory of the item’s price was attached to inventoried instances, which were deleted. Notice also that in this model there is duplicated data (description, price, itemID). Item description price serial number itemID

10 The Need for Specification or Description Conceptual Classes
When should we add a specification or description concept? ProductSpecification description price itemID 1 Describes * Conceptual classes – categories, noun phrase identification, Item serial number

11 The NextGen POS (partial) Domain Model
Item Store Sale Sales LineItem Cashier Customer Manager Payment Product Catalog Product Specification

12 Adding Associations “Direction reading arrow” has no meaning
other than to indicate direction of reading the association label. Optional (often excluded) POS Records-current Sale Association: relationship between classes, meaningful, interesting connection, preserved for some duration, between what models do wen need a memory of a relationship “need to remember”. NOT a statement about data flows! Paths of navigation and visibility ClassName – VerbPhrase - ClassName 1 1 Association name

13 Finding Associations –Common Associations List
Category Examples A is a physical part of B* Drawer - POS A is a logical part of B SalesLineItem - Sale A is physically contained in/on B POS - Store A is logically contained in B ItemDescription - Catalog A is a description of B ItemDescription - Item A is a line item of a transaction or report B SalesLineItem - Sale A is known/logged/recorded/ captured in B Sale - POS A is a member of B Cashier - Store ... (See complete list in Larman 2nd. ed., pp ) * High-priority associations

14 Multiplicity Store Stocks Item 1 * Multiplicity *: zero or more
Multiplicity: how many instances of class A can be associated with an instance of class B

15 Multiplicity * T Zero or more; “many” 1..* T One or more 1..40 T
One to forty 5 T Exactly five 3, 5, 8 T Exactly three, five or eight.

16 Naming Associations Store Name an association based on a TypeName-VerbPhrase- TypeName format. Association names should start with a capital letter. A verb phrase should be constructed with hyphens. The default direction to read an association name is left to right, or top to bottom. 1 Contains 1..* POS 1 Captures 1..* Paid-by Sale Payment 1 1

17 Multiple Associations Between Two Types
It is not uncommon to have multiple associations between two types. In the example, not every flight is guaranteed to land at an airport. Flies-to 0..1 * Flight Airport Flies-from * 1

18 Adding Attributes Sale date startTime: Time Attributes
Attribute: logical data value of an object Visibility name: type multiplicity – default [property-string] / derived attribute: calculated -, +: private, public Domain model: no types of attributes! Guidelines for modeling data types: represent smt as a new data type class in domain model if: It is composed of separate sections Operations associated with it Has other attributes Is quantity with unit It is an abstraction

19 Valid Attribute Types Cashier Not a simple attribute name
currentRegister Cashier Register name uses number 1 1

20 Domain Model Conclusion
Records-sale-of 1 0..1 Described-by * Product Catalog Product Specification Sales LineItem Contains description price itemID 1 1..* quantity 1 Used-by 1..* * Describes 1..* Store Item 1 * Contained-in Logs-completed address name Stocks 1 * 1 * Sale 1 Houses 1..* date time Captured-on POS Manager Started-by 1 1 1 1 Conclusion: is DM correct? Yes if it captures the essential abstractions and information required. Avoid waterfall mindset of analysis paralysis, limit domain modeling to a few hrs per iteration 1 1 Paid-by Initiated-by 1 1 1 Records-sales-on Payment Customer Cashier 1 amount


Download ppt "Domain Model: Visualizing Concepts"

Similar presentations


Ads by Google