230 likes | 346 Views
Domain Model Visualizing Concepts. Chapter 9 Applying UML and Patterns Craig Larman. Comments on diagrams.
E N D
Domain Model Visualizing Concepts Chapter 9 Applying UML and Patterns Craig Larman
Comments on diagrams • Now that we are starting to look at diagrams, I want to emphasize that this is a class on analysis and design, not diagramming. While it may look good on your resume that you can use UML, your career depends on being able to translate ideas into good systems. That is much more difficult.
Domain Model Relationships Domain Model Business Model Classes, attributes, associations Elaboration on some terms Domain objects Use Case Model Glossary Requirements Interaction Diagrams Design
A Domain Model • illustrates meaningful conceptual classes in a problem domain. • is a representation of real-world concepts, not software components. • is NOT a set of diagrams describing software classes, or software objects and their responsibilities.
A Domain Model is the most important OO artifact • Its development entails identifying a rich set of conceptual classes, and is at the heart of object oriented analysis. • It is a visual representation of the decomposition of a domain into individual conceptual classes or objects. • It is a visual dictionary of noteworthy abstractions.
Domain Model UML Notation • Illustrated using a set of class diagrams for which no operations are defined. It may contain: • Domain Objects or Conceptual Classes • Associations between conceptual classes • Attributes of conceptual classes
A Domain Model is not a Software Artifact Software Artifacts: A Conceptual class: vs.
Think of Conceptual Classesin terms of: • Symbols – words or images • Intensions – its definition • Extensions – the set of examples to which it applies • Symbols and Intensions are the practical considerations when creating a domain model.
Decomposition: • A central distinction between Object-oriented analysis and structured analysis is the division by objects rather than by functions during decomposition. • During each iteration, only objects in current scenarios are considered for addition to the domain model.
Conceptual Class Identification: • It is better to overspecify a domain with lots of fine-grained conceptual classes than it is to underspecify it. • Discover classes up front rather than later. • Unlike data modeling, it is valid to include concepts for which there are no attributes, or which have a purely behavioral role rather than an informational role.
Identify Conceptual Classesby Category List: Common Candidates for classes include: Tangible objects, Descriptions, Roles, Places, Transactions, Containers, Systems, Abstract nouns, Rules, Organizations, Events, Processes, Written Materials, Catalogs, Records, Financial Instruments and Services
Identify Conceptual Classesby Noun Phrase: • Identify Nouns and Noun Phrases in textual descriptions of the domain. • Fully dressed Use Cases are good for this type of linguistic analysis. It’s not strictly a mechanical process: • Words may be ambiguous • Different phrases may represent the same concepts.
Sales Domain example - ‘Purchase Items’ Use Case • We find concepts such as Register, Sale, Item, Customer, Receipt etc. in this use case. Should we include Receipt in the Model? • Con: As a report of a sale, it’s duplicate info. • Pro: Business Rules for a Return require that the customer has a receipt. • Suggestion: Include it in the iteration where the Return Use Case is covered.
Steps to create a Domain Model • Identify Candidate Conceptual classes • Draw them in a Domain Model • Add associations necessary to record the relationships that must be retained • Add attributes necessary for information to be preserved • Apply existing Analysis Patterns
Apply the Mapmaker Strategy • Use existing names for things, the vocabulary of the domain • Exclude irrelevant features • Do not add things that are not there
A Common Mistake - Classes as Attributes • Rule: If we do not think of a thing as a number or text in the real world, then it is probably a conceptual class. • If it takes up space, then it is likely a conceptual class. Examples: • A Store is not an attribute of a Sale • A Destination is not an attribute of a flight
Specification or Description Conceptual Classes • A Class that records information about an item. • Even if all Instances of the item are sold out, the description remains. • Avoids duplication of recording the descriptive information with each instance of the item.
Description of a Service Example (Flight) Flies-to vs. Described -by Describes -flights-to
Monopoly Concepts (candidates) Monopoly Game Player Piece Square Die Board
UML Notation: Multiple Perspectives • UML describes raw diagram types, such as class diagrams. It does not impose a specific method or process. • UP, the Unified Process, applies raw UML to defined methodology models. UML can be used for 3 different perspectives: • Essential – describe the real world • Specifications – software abstractions, such as components and their interfaces • Implementation – specific language (Java)