Domain Model-Class Diagram
Domain Model-Class Diagram
Lecture 7
Objectives
Explain the purpose of domain modelling. Explain what a conceptual class is. List techniques for finding conceptual classes. Define the terms Aassociations and Attributes . Identify and explain different types of association present in a domain model . Create a domain class diagram for a given domain, using correct UML class diagram notation.
3/11/2013
Definition
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 Domain model (Conceptual Model)is produced during the analysis and it is not a description of software objects; but it is visualization of concepts in the realworld domain. It has identification of the concepts, attributes and associations as shown below:
Payment PAYS-FOR Sales). Attributes for information content (e.g. Sale records DATE and TIME). Does not include operations / functions. Does not describe software classes. Does not describe software responsibilities. Input
Problem Description, Use Cases,
3/11/2013
3/11/2013
UML and domain model can be used in place of ERD in traditional approach
3/11/2013
Category List
3/11/2013
are good for this type of linguistic analysis However: Words may be ambiguous or synonymous Noun phrases may also be attributes or parameters rather than classes:
If it stores state information or it has multiple behaviors,
then its a class If its just a number or a string, then its probably an attribute
3/11/2013
VideoStore
Stocks 1
Video
14
association name
multiplicity
3/11/2013
16
3/11/2013
GUIDELINES: Associations
Only add associations for noteworthy relationships. Literally, those for which making a note is worthy or business motivated.
1..* 1 Customer ... Rents ... Video
1 ...
Loan Policy
3/11/2013
Identifying Attributes
Show only simple relatively primitive types as attributes. Connections to other concepts are to be represented as associations, not attributes.
attributes
10
3/11/2013
Class or Attributes
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 attributes
Association class
11
3/11/2013
24
12
3/11/2013
Generalization/Specialization
Generalization means grouping similar types of things (e.g., motor
vehicles group cars, trucks and tanks. They share certain general features (e.g., wheels, engine, etc.), so motor vehicle is a more general class) Specializations are judgments that categorize different types of things (e.g., sports car is a special type of car) A generalization/specialization hierarchy is used to structure (or rank) things from the more general down to the more special Each class has a more general class above it a superclass A class may have a more specialized class below a subclass Inheritance the concept that subclasses classes inherit characteristics of the more general superclass
25
26
13
3/11/2013
Abstract class a class that allow subclasses to inherit characteristics but never gets instantiated. In Italics (Sale above) Concrete class a class that can have instances
27
Inheritance
Inheritance is a concept that allows subclasses to share
characteristics of their superclasses E.g. a sports car has everything a car has (e.g., 4 wheels and an engine, which it inherits from the class car which is above it) The sports car then specializes E.g., has a sports option, racing wheels, etc. In the object-oriented approach, inheritance is a key concept that is possible because of generalization/specialization hierarchies (these hierarchies are often called inheritance hierarchies)
28
14
3/11/2013
29
Whole-Part Relationships
Whole-part hierarchies relationships that structure classes by components where one class is part of or a component portion of another class Aggregation whole-part relationships between and object and its removable parts
Parts can exist separately Like car and its tires
Composition whole-part relationships between and object and its non-removable parts.
Parts cannot exist separately Like Hand is composed of fingers and thumb
30
15
3/11/2013
31
16
3/11/2013
33
The Customer class and the Account class are associated Each customer can have zero or more accounts (the diagram shows the minimum and maximum cardinality on the line connecting the classes, and the asterisk means many Each account is owned by one and only one customer The SavingsAccount and CheckingAccount classes inherit the association with the Customer class The Account class is an abstract class (i.e., the class that cannot be instantiated, existing only to allow subclasses to inherit its attributes, methods and associations) shown in italics SavingsAccount, CheckingAccount and Customer are examples of class are concrete classes that can be instantiated (i.e., objects can be created)
34
17
3/11/2013
18
3/11/2013
Notice how this can be viewed as a visual dictionary. It illustrates concepts, words, things in a domain
38
19