Title: Object Modeling Techniques
1Object Modeling Techniques
2Overview
- Identify objects and classes
- Prepare a data dictionary
- Identify associations between objects
- Identify attributes of objects and links
- Structure object classes using inheritance
- Verify access paths for likely queries
- Iterate and refine the model
3Identify Objects and Classes
- Perform textual analysis.
- The following notes should be taken into
consideration - Not all objects can be identified from the use
case description. - A class should have a well-defined scope.
- A class need not be normalized.
- No need to be too selective at this stage
- Focus on identifying the objects first, forget
about the other issues, such as inheritance.
4Prepare a Data Dictionary
- Write a paragraph describing each modeled
elements in the class diagram. - Describe the scope of the class and associations.
5Identify Associations
- Look for verbs or verb phrases linking 2 or more
objects. e.g. Customer Service Assistant enters
the sale order into the system - Look for ownership or containment, such as
- e.g. A sale order can contain several items
- e.g. A student has one or two supervisors
6Maintain the Right Associations
- N-ary Associations
- It is often possible to decompose N-ary
associations among 3 or more classes into two or
more binary associations or re-phrased as
qualified associations - e.g. Decompose Customer service assistant enters
a sale order for a member into - customer service assistant enters a sale order
- a sale order is issued by a member
- Sometimes, it is not possible to decompose a
N-ary association without losing information,
e.g. A lecturer teaches a group of students in a
room on a day at a time.
7Keep the Right Associations (Cont)
- Derived Associations
- Remove associations that can be derived
indirectly from other associations, such as - e.g. A deposit request is sent to the member
can be derived from A member issues an order.
and A deposit request is issued for an order
which has a re-order amount exceeds the members
re-order limit. - Conditions on attributes
- e.g. more than is defined as a condition of the
order amounts. - Misnamed Associations
- Names need not reflect historical events
- e.g. Member has an order vs Member issued an
order ? - For many multiplicity, consider whether a
qualifier is needed
8Keep the Right Associations (Cont)
- Multiplicity
- Specify multiplicity, but dont spend too much
effort on it. - Multiplicity is often changed in the analysis.
- Double check for multiplicity of 1.
- For many multiplicity, consider whether the
objects are ordered.
9Identify Attributes
- Simple values
- Attributes are properties of individual objects
- Look for nouns followed by possessive phrases,
- e.g. the description of an item
- the address of a member
- Adjectives often indicate attribute values
- e.g. red, on, expired
10Structure with Inheritance
- Identify inheritance by bottom up approach
- Look for similar classes and generalize classes
into a superclass - Identify inheritance by top down
- Refine a class into specialized subclasses
- Look for the following phases
- is-a-kind-of
- is-a
- Search for classes with similar attributes,
associations, or operations
11Test Access Paths
- Verify the class diagram can support the required
queries. - Trace the access paths through the class diagram
to see whether they give results consistent with
the expected results. - e.g. Find all members which are affected by the
deposit request. It is not current supported by
the class diagram as the navigation direction is
from reorder request to deposit request. It would
give one member only if the reverse direction of
the navigation is supported. - Unique result for 1 associations?
- For many associations, can we pick up a unique
result when so required?
12Iterative Object Modeling
- Like other models, the class diagram is developed
in an iterative and incremental manner. Different
parts of the class diagram may be at different
stages of completion - Refine the class diagram after creating the
interaction diagrams and state diagrams.
13Example Mail Order System
- Data Dictionary
- Member an individual or an organization that
have been registered for the use of mail ordering
service. A register member can order goods by
sending a mail order form to the customer service
assistant. Each member is assigned an re-order
credit limit. A member who has not been active
for a year will be archived. - Order an order is entered by the customer
service assistant when a mail order form is
received from a member. An order contains a list
of items, prices and quantities of the items.
14Example Mail Order System (Cont)
- Identify Associations
- The Customer Service Assistant will first check
for a valid membership and enter the sale order
into the system. - gt entered by association between Customer
Service Assistant and Order - The Order Process Clerk checks the availability
of items of the sale order and hold the items for
the order. When all items are available, the
Order Process Clerk will schedule the delivery of
the items. - gt handled by association between Order Process
Clerk and the Order.
15Example Mail Order System (Cont)
Initial Class Diagram
16Example Mail Order System (Cont)
Design sequence diagram
17Example Mail Order System (Cont)
Partly Revised Class diagram