0% found this document useful (0 votes)
56 views

Object Oriented Analysis and Design Define Class Diagram

This document discusses class diagrams and design patterns in object-oriented analysis and design. It defines responsibilities as what classes are responsible for creating other class objects or performing actions. Responsibilities can be traced from interaction diagrams. Design patterns guide the identification of classes and relationships between classes. The document describes several design patterns including information expert, creator, coupling, cohesion, and controller.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views

Object Oriented Analysis and Design Define Class Diagram

This document discusses class diagrams and design patterns in object-oriented analysis and design. It defines responsibilities as what classes are responsible for creating other class objects or performing actions. Responsibilities can be traced from interaction diagrams. Design patterns guide the identification of classes and relationships between classes. The document describes several design patterns including information expert, creator, coupling, cohesion, and controller.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 11

Object Oriented Analysis and Design

Define Class Diagram

1
Design Patterns
 Design patterns are design rules which act as a
guide line while identifying classes.
 Eventually ending up with a class diagram
 Class diagram should follow these design
patterns.

2
Responsibilities
 Responsibilities: means which class is
responsible to create other class’s object or
which class is responsible to perform which
action. Responsibilities can be traced from
Sequence/collaboration Interaction Diagram.
Responsibility is of two Types:

3
Responsibilities
 Doing:
 creating an object of other class to call its functions
 initiating action in other objects
 controlling activities in other objects
 doing any calculations
 Example:
Class “sale” is responsible for creating the object of class
“SalesLineItem”.
Class “DiceGame” is responsible to create the object of
class “Die” because it has to call Dies class’s functions of
“roll()” and “getFaceValue()”

4
Responsibilities
 Knowing:
 1. knowing about related objects
 2. knowing about private encapsulated data
 3. knowing about things it can derive or calculate
Example:
Class “sale” is responsible for knowing total of sales.
Methods/Functions: methods are used to fulfill responsibility.
Returning the face value is the responsibility of “Die” class
and “getFaceValue()” method satisfy this responsibility.
Pattern
A named description of problem solution for a new context.

5
DP: Information Expert
 Problem: what is the basic principal to assign
responsibility to an object?
 Solution: assign responsibility using Information
Expert, means which class has responsibility to
fulfill the responsibility.
 Example:
 ‘Die” class is Information Expert for rolling
dice and returning face value to DiceGame class
because ‘Die” class has enough information
(knows about face value) to do these functions.
See Interaction Diagram

6
DP: Creator
 Problem: which object/class is responsible to
create instance of another object/class?
 Solution: class ‘B’ is responsible to create an
instance of class ‘A’ if all or any one of these is
true:
 1. B aggregates A
 2. B contains A objects
 3. B records A instances
 4. B has close link with A objects

7
DP: Creator
 Example:
 “DiceGame” class needs to call the
roll() and getfacevalue() functions of class “Die”
as the interaction diagram shows so it is
CREATOR class ( suited to create ‘Die’ type
objects d1 and d2)

8
DP: Coupling
 Problem: how to support low dependency, low
change impact and increased reuse?
 Solution: assign responsibility so coupling
remains low.

9
DP: Cohesion
 Problem: how to keep complexity manageable?
 Solution: classes are focused.

 If coupling is low then cohesion automatically is


high.

10
DP: Controller
 system events should be in those classes
which are responsible for starting and ending
processes and events

11

You might also like