Oose Unit 3.1
Oose Unit 3.1
D.Sudhagar/Associate Professor
UNIT - III OBJECT ORIENTED SOFTWARE DESIGN
Object Oriented Design – Interaction Diagrams – Sequence Diagram –
Collaboration Diagrams – Refinement of Use Case Description –
Refinement of Classes and Relationships – Construction of Detailed Class
Diagram – Development of Detailed Design & Creation of Software Design
Document - Object Oriented Methods : Object Oriented Analysis (OOA /
Coad-Yourdon), Object Oriented Design (OOD/Booch) , Hierarchical Object
Oriented Design (HOOD), Object Modeling Technique (OMT), Responsibility
– Driven Design Case Studies : Warehouse Management System, Telecom.
Reference:
1. Yogesh Singh, Ruchika Malhotra, “Object – Oriented Software
Engineering”, PHI Learning Private Limited ,First edition, 2012
Object Oriented Software Life Cycle
Object Oriented Design(OOD)
• 2 stages
1. Conceptual design
2. Detailed design
Conceptual design
• Recognize all the classes required to build the system
• Responsibilities are allocated to each class
• In high level design,
• Class diagram – analyse the relationship between classes
• Interaction diagram – shows the flow of the events.
Detailed design
• Attributes and operations are allocated to each class based on their interaction
diagram.
• The state machine diagram is developed to explain the next details of the design is
called as low-level design.
Interaction Diagrams
Interaction Diagrams
1: OffHooke
2: DialTone 3: Dial Number
Exchange
4: RingTone
Receiver
5: OffHook
6: OnHook
Talk
Collaboration Diagrams
Telephone Call
Object Caller Message
Exchange
2.2: RingTone
Receiver
3.1: OffHook
4.1: OnHook
Talk
Collaboration Diagrams (continued)
.
Sequence Diagrams
• Sequence diagrams are an easy and intuitive way
of describing the behavior of a system.
• A sequence diagram shows an interaction
arranged in a time sequence.
Telephone Call
Caller Exchange Receiver Talk
OffHook
DialTone
Dial Number
RingTone
OffHooke
OnHook
Sequence Diagrams
System sequence diagrams show only messages
between the system and actors.
.
Creating Sequence Diagrams (continued)
.
Sequence Diagrams (continued)
.
Design Class Diagrams
A design class diagram follows the same conventions as a domain
model.
However, it also shows the operations of the classes.
Design Class Diagrams (continued)
.
Procedure for Object-Oriented Design
36
How do we design classes?
• class identification from project spec / requirements
• nouns are potential classes, objects, fields
• verbs are potential methods or responsibilities of a class
• UML diagrams
• class diagrams (today)
• sequence diagrams
• ...
37
Introduction to UML
• UML: pictures of an OO system
• programming languages are not abstract enough for OO design
• UML is an open standard; lots of companies use it
38
Uses for UML
• as a sketch: to communicate aspects of system
• forward design: doing UML before coding
• backward design: doing UML after coding as documentation
• often done on whiteboard or paper
• used to get rough selective ideas
39
UML class diagrams
• What is a UML class diagram?
n UML class diagram: a picture of the classes in an
OO system, their fields and methods, and
connections between the classes that interact or
inherit from each other
n details of how the classes interact with each other
40
Diagram of one class
• class name in top of box
• write <<interface>> on top of interfaces' names
• use italics for an abstract class name
• attributes (optional)
• should include all fields of the object
41
Class attributes
• attributes (fields, instance variables)
• visibility name : type [count] = default_value
• visibility: + public
# protected
- private
~ package (default)
/ derived
• underline static attributes
• attribute example:
- balance : double = 0.00
42
Class operations / methods
• operations / methods
• visibility name (parameters) : return_type
• visibility: + public
# protected
- private
~ package (default)
• underline static methods
• parameter types listed as (name: type)
• omit return_type on constructors and
when return type is void
• method example:
+ distance(p1: Point, p2: Point): double
43
Comments
• represented as a folded note, attached to the appropriate
class/method/etc by a dashed line
44
Relationships btwn. classes
• generalization: an inheritance relationship
• inheritance between classes
• interface implementation
45
Generalization relationships
• generalization (inheritance) relationships
• hierarchies drawn top-down with arrows pointing
upward to parent
• line/arrow styles differ, based on whether parent is
a(n):
• class:
solid line, black arrow
• abstract class:
solid line, white arrow
• interface:
dashed line, white arrow
46
Associational relationships
• associational (usage) relationships
1. multiplicity (how many are used)
• * 0, 1, or more
• 1 1 exactly
• 2..4 between 2 and 4, inclusive
• 3..* 3 or more
2. name (what relationship the objects have)
3. navigability (direction)
47
Multiplicity of associations
n one-to-one
n each student must carry exactly one ID card
n one-to-many
n one rectangle list can contain many rectangles
48
Car
Association types 1
aggregation
1
• aggregation: "is part of"
Engine
• symbolized by a clear white diamond
Book
• composition: "is entirely made of" composition
• stronger version of aggregation 1
• the parts live and die with the whole *
• symbolized by a black diamond Page
50
Class diagram example 2
Multiplicity
Customer
1 Simple
Class Aggregation
Composition Simple
Generalization
Association
Checkout Screen
DVD Movie VHS Movie Video Game
51
Class diagram example 3
StudentBody Student
1 100
- firstName : String
+ main (args : String[]) - lastName : String
- homeAddress : Address
- schoolAddress : Address
+ toString() : String
Address
- streetAddress : String
- city : String
- state : String
- zipCode : long
+ toString() : String
52
Tools for creating UML diags.
• Violet (free)
• http://horstmann.com/violet/
• Rational Rose
• http://www.rational.com/
53
Development of Detailed Design &
Creation of Software Design Document