I. Domain Model: Visualizing Concepts (Ch 10) ------------------------------------------ THE DOMAIN MODEL (Ch. 10) Domain model: - describes concepts of the problem (the "real world") as classes - not about the software/implementation - a "visual dictionary of abstractions" Essential for OO: - often implementation classes match these concepts - model of business/enterprise/domain helps in reuse of analysis/design/code ------------------------------------------ What makes this OO? A. Example (10.1) What conceptual classes of objects are important in the Process Sale use case? What are their attributes? ------------------------------------------ PARTIAL DOMAIN MODEL (Fig 10.1) |-----------| |---------| | Sales | Records-sale-of | Item | | LineItem |-----------------|---------| |-----------|0..1 1| | | quantity | |---------| |-----------| |* |1..* Stocked-in| | | |Contained-in |1 | |---------| |1 | Store | |-----------| |---------| | Sale | | address | |-----------| | name | | date |----| |---------| | time |1 | |1 |-----------| | | 1| | Houses| | | | Paid- | | | by | | |---------| | | Captured-on| Register| 1| |------------|---------| |-----------| 1| | | Payment | |---------| |-----------| | amount | |-----------| ------------------------------------------ B. Conceptual Class Identification (10.2-3) ------------------------------------------ SCOPE OF THE DOMAIN MODEL (10.2) Don't build domain model all at once: - build it over several iterations - limit to prior and current scenarios HOW MANY CLASSES IS ENOUGH? Better too many than too few - because used for inspiration - can be added if discovered later - okay if have no attributes ------------------------------------------ 1. strategies for identifying conceptual classes a. Use a conceptual class category list ------------------------------------------ WAYS TO IDENTIFY CONCEPTUAL CLASSES (1) Conceptual class category list: - physical or tangible objects - specifications, designs, descriptions of things - places - transactions - transaction line items - roles of people - containers of other things - things in a container - other (computer) systems - abstract noun concepts - organizations - events - processes (often not concepts...) - rules and policies - catalogs - records of finance, work, and contracts - financial instruments and services - manuals, documents, books ------------------------------------------ What about reports? Should they be included? b. Identify noun phrases c. Use analysis patterns d. practice C. Guidance ------------------------------------------ HOW TO MAKE A DOMAIN MODEL (10.4) 0. Start with a use case/scenario 1. Brainstorm for conceptual classes - use conceptual class category list - use noun phrase identification 2. Draw them in a domain model 3. Add associations that must be remembered 4. Add attributes necessary to track information Mapmaker's Advice: - use existing names in the territory - exclude irrelevant features - don't add new things ------------------------------------------ why is it helpful to use the existing names in the domain? why shouldn't you add new concepts that aren't in the real world? 1. a common mistake Should store be a conceptual class or an attribute? Price? Flight? Airport? D. Specification or description conceptual classes (10.7) Where should a record of what airport flight goes to to be recorded? Where should the description of a package plan for a cable TV company go? E. Perspectives (10.8) ------------------------------------------ PERSPECTIVES ON CLASS DIAGRAMS (10.8) - Conceptual describe things in the domain - Specification describe software abstractions (interfaces and intentions) - Implementation describe software implementations The implementation perspective is the *least* useful. ------------------------------------------ F. Lowering the representational gap (10.9) Why choose to have a software/implementation class "Sale" that matches the conceptual class "Sale"? ------------------------------------------ CONCEPTUAL CLASSES INSPIRE SOFTWARE CLASSES Domain Model: |-----------| |---------| | Payment |1 Pays-for 1| Sale | |-----------|-----------------|---------| | amount | | date | |-----------| | time | |---------| Inspires Design Model: |-------------| |-----------| | Payment |1 Pays-for 1| Sale | |-------------|<----------->|-----------| | amount:Money| | date:Date | |-------------| | startTime:| | getBalance()| |-----------| |-------------| | getTotal()| | ... | |-----------| ------------------------------------------ G. Questions how long should domain modeling take?