Chapter 21 Design Patterns Reviewed from the New Perspective of Object-Oriented Design - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Chapter 21 Design Patterns Reviewed from the New Perspective of Object-Oriented Design

Description:

Chapter 21 Design Patterns Reviewed from the New Perspective of Object-Oriented Design Ku-Yaw Chang canseco_at_mail.dyu.edu.tw Assistant Professor, Department of – PowerPoint PPT presentation

Number of Views:251
Avg rating:3.0/5.0
Slides: 21
Provided by: IBM7185
Category:

less

Transcript and Presenter's Notes

Title: Chapter 21 Design Patterns Reviewed from the New Perspective of Object-Oriented Design


1
Chapter 21Design Patterns Reviewedfrom the New
Perspective of Object-Oriented Design
  • Ku-Yaw Chang
  • canseco_at_mail.dyu.edu.tw
  • Assistant Professor, Department of Computer
    Science and Information Engineering
  • Da-Yeh University

2
Outline
  • A Summary of Object-Oriented Principles
  • How Design Patterns Encapsulate Implementations
  • Commonality/Variability Analysis and Design
    Patterns
  • Decomposing a Problem Domain into
    Responsibilities
  • Relationships Within a Pattern
  • Patterns and Contextual Design
  • Field Notes
  • Summary

3
A Summary ofObject-Oriented Principles
  • Objects are things with well-defined
    responsibilities.
  • Objects are responsible for themselves.
  • Encapsulation means any kind of hiding
  • Data hiding
  • Class hiding
  • Implementation hiding
  • Abstract out variations in behavior and data with
    commonality/variability analysis.
  • Design to interfaces.

4
A Summary ofObject-Oriented Principles
  • Think of inheritance as a method of
    conceptualizing variation, not for making special
    cases of existing objects.
  • Keep variations in a class decoupled from other
    variations in the class.
  • Strive for loose coupling.
  • Strive for high cohesion.
  • Be absolutely meticulous in applying the once and
    only once rule

5
Outline
  • A Summary of Object-Oriented Principles
  • How Design Patterns Encapsulate Implementations
  • Commonality/Variability Analysis and Design
    Patterns
  • Decomposing a Problem Domain into
    Responsibilities
  • Relationships Within a Pattern
  • Patterns and Contextual Design
  • Field Notes
  • Summary

6
How Design PatternsEncapsulate Implementations
  • Most patterns described by GoF
  • Give ways to hide specific implementations
  • Allow for easily adding new implementations

7
Outline
  • A Summary of Object-Oriented Principles
  • How Design Patterns Encapsulate Implementations
  • Commonality/Variability Analysis and Design
    Patterns
  • Decomposing a Problem Domain into
    Responsibilities
  • Relationships Within a Pattern
  • Patterns and Contextual Design
  • Field Notes
  • Summary

8
Commonality/Variability Analysis and Design
Patterns
  • An example
  • Draw a square with drawing program one
  • Draw a circle with drawing program two
  • Draw a rectangle with drawing program one
  • Tow commonalities
  • Drawing programs
  • Shapes to draw
  • Patterns
  • Provide the backdrop in analysis and design
  • Give a common vocabulary for discussion
  • Incorporate best-practice approaches into your
    code

9
Outline
  • A Summary of Object-Oriented Principles
  • How Design Patterns Encapsulate Implementations
  • Commonality/Variability Analysis and Design
    Patterns
  • Decomposing a Problem Domain into
    Responsibilities
  • Relationships Within a Pattern
  • Patterns and Contextual Design
  • Field Notes
  • Summary

10
Decomposing a Problem Domain into Responsibilities
  • In the Bridge pattern
  • Problem domain composed of two different types of
    entities
  • Abstractions
  • Implementations
  • Decompose the problem domain
  • Objects
  • Which objects are needed
  • Responsibilities
  • How these objects are instantiated

11
Outline
  • A Summary of Object-Oriented Principles
  • How Design Patterns Encapsulate Implementations
  • Commonality/Variability Analysis and Design
    Patterns
  • Decomposing a Problem Domain into
    Responsibilities
  • Relationships Within a Pattern
  • Patterns and Contextual Design
  • Field Notes
  • Summary

12
Relationships Within a Pattern
  • Alexander
  • At this final stage, the patterns are no longer
    important.
  • Shalloway
  • The patterns have taught your to be receptive to
    what is real.
  • Relationships and forces described by the
    patterns
  • It is not the patterns themselves that are
    important

13
Outline
  • A Summary of Object-Oriented Principles
  • How Design Patterns Encapsulate Implementations
  • Commonality/Variability Analysis and Design
    Patterns
  • Decomposing a Problem Domain into
    Responsibilities
  • Relationships Within a Pattern
  • Patterns and Contextual Design
  • Field Notes
  • Summary

14
Patterns and Contextual Design
  • Patterns are microcosmic examples of contextual
    design
  • Designing to an interface is designing within a
    context

15
Outline
  • A Summary of Object-Oriented Principles
  • How Design Patterns Encapsulate Implementations
  • Commonality/Variability Analysis and Design
    Patterns
  • Decomposing a Problem Domain into
    Responsibilities
  • Relationships Within a Pattern
  • Patterns and Contextual Design
  • Field Notes
  • Summary

16
Field Notes
  • What implementations does this pattern hide?
  • Allow for changing them
  • What commonalities are present in this pattern?
  • Identify them
  • What are the responsibilities of the objects in
    this pattern?
  • Easier to do my decomposition by responsibility

17
Field Notes
  • What are the relationships between these objects?
  • More information about the forces
  • How may the pattern itself be a microcosmic
    example of designing by context
  • A better understanding of why the pattern is good
    design

18
Outline
  • A Summary of Object-Oriented Principles
  • How Design Patterns Encapsulate Implementations
  • Commonality/Variability Analysis and Design
    Patterns
  • Decomposing a Problem Domain into
    Responsibilities
  • Relationships Within a Pattern
  • Patterns and Contextual Design
  • Field Notes
  • Summary

19
Summary
  • Look at patterns by seeing
  • What they encapsulate
  • How they use commonality/variability analysis
  • How they decompose a problem domain into
    responsibilities
  • How they specify relationships between objects
  • How they illustrate contextual design

20
The End
Write a Comment
User Comments (0)
About PowerShow.com