Beruflich Dokumente
Kultur Dokumente
Object-Oriented
Design and Modeling
Using the UML
McGraw-Hill/Irwin
Objectives
18-2
18-3
Object-Oriented Design
Object-oriented design (OOD) an
approach used to specify the software
solution in terms of collaborating objects,
their attributes, and their methods.
Continuation of object-oriented analysis
18-4
Design Classes
In OO programming
every piece of code
resides inside an
object class
18-5
18-7
18-8
18-9
Object Responsibilities
Object responsibility the obligation
that an object has to provide a service
when requested and thus collaborate with
other objects to satisfy the request if
required.
An object responsibility is implemented by
the creation of methods that may have to
collaborate with other objects and
methods.
18-10
Object Responsibility
18-11
18-12
Implementation details
Controls
Window/web page names
Navigation instructions
18-14
18-15
18-16
18-17
18-19
Controller Classes
Place New Order Handler
Entity Classes
Billing Address
Shipping Address
Email Address
Active Member
Member Order
Member Ordered Product
Product
Title
Audio Title
Game Title
Video Title
Transaction
18-20
Control
Entity
Interface
18-22
Class Type
Entity
Interface
Entity
Entity
Entity
Entity
Interface
Prompt user
Interface
Entity
18-24
Collaborators
Member Ordered Product
Sequence Diagram
18-25
1.
2.
3.
4.
5.
Actor
Interface class
Controller class
Entity classes
Messages
6.
7.
8.
9.
Activation bars
Return messages
Self-call
Frame
18-26
18-27
18-28
18-29
18-30
18-31
18-32
Classes
Associations and gen/spec and aggregation
relationships
Attributes and attribute-type information
Methods with parameters
Navigability
Dependencies
18-34
18-35
Object Reusability
Coupling - the degree to which one class is
connected to or relies upon other classes.
Cohesion - the degree to which the
attributes and behaviors of a single class
are related to each other.
18-36
Object Reusability
The OO Success Story
18-37
Project Duration
(calendar months)
Level of Effort
(person months)
Software Size
(lines of code)
PL/1
19
152
265,000
Smalltalk
3.5
10.4
22,000
Design Patterns
Design pattern - a common solution to a
give problem in a given context, which
supports reuse of proven approaches and
techniques.
Advantages
18-38
18-39
Gang-of-Four Patterns
Creational
Abstract factor
Builder
Factory method
Prototype
Singleton
18-40
Structural
Adapter
Bridge
Composite
Decorator
Faade
Proxy
Behavioral
Chain of responsibility
Command
Flyweight
Interpreter
Iterator
Mediator
Memento
Observer
State
Strategy
Template method
Visitor
Strategy Pattern
Pattern:
Category:
Problem:
Solution:
18-41
Strategy
Behavioral
How to design for varying and changing policy algorithms?
Define each algorithm in a separate class with a common
interface.
Adapter Pattern
Pattern:
Category:
Problem:
Solution:
18-42
Adapter
Structural
How to provide a stable interface to similar classes with
different interfaces?
Add a class that acts as an adapter to convert the interface
of a class into another interface that the client classes
expect.
18-44
Communication Diagram
1.
2.
3.
4.
18-45
Class
Messages
Self-calls
Numbering scheme - messages should be numbered with a nested
scheme.
Component Diagram
18-46
Deployment Diagram
18-47