Chapter Five An Introduction to Design Patterns - PowerPoint PPT Presentation

Loading...

PPT – Chapter Five An Introduction to Design Patterns PowerPoint presentation | free to download - id: 75f829-NTc4M



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Chapter Five An Introduction to Design Patterns

Description:

Chapter Five An Introduction to Design Patterns Ku-Yaw Chang canseco_at_mail.dyu.edu.tw Assistant Professor, Department of Computer Science and Information Engineering – PowerPoint PPT presentation

Number of Views:22
Avg rating:3.0/5.0
Slides: 26
Provided by: IBM7185
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Chapter Five An Introduction to Design Patterns


1
Chapter FiveAn Introduction toDesign Patterns
  • Ku-Yaw Chang
  • canseco_at_mail.dyu.edu.tw
  • Assistant Professor, Department of Computer
    Science and Information Engineering
  • Da-Yeh University

2
Outline
  • Overview
  • Design Patterns Arose from Architecture and
    Anthropology
  • Moving from Architectural to Software Design
    Patterns
  • Why Study Design Patterns?
  • Other Advantages to Studying Design Patterns
  • Summary

3
Overview
  • Design patterns
  • Cutting edge of the OO technology
  • Relationships
  • Master OO skills first, then learn design
    patterns
  • The opposite is also true
  • Learning design patterns early in the learning of
    object-oriented skills greatly helps to improve
    understanding of object-oriented analysis and
    design.
  • Design patterns and OO design reinforce each
    other
  • Many ideas are from
  • Christopher Alexanders Timeless Way of Building

4
Outline
  • Overview
  • Design Patterns Arose from Architecture and
    Anthropology
  • Moving from Architectural to Software Design
    Patterns
  • Why Study Design Patterns?
  • Other Advantages to Studying Design Patterns
  • Summary

5
Design Patterns Arose from Architecture and
Anthropology
  • Christopher Alexander asked himself
  • Is quality objective?
  • What makes us know when an architectural design
    is good?
  • Alexander postulates
  • There is such an objective basis within
    architectural systems.
  • We can describe beauty through an objective basis
    that can be measured.

6
Design Patterns Arose from Architecture and
Anthropology
  • If quality in design is objective
  • Be able to identify what makes designs good and
    what makes designs bad
  • Alexander asked
  • What is present in a good quality design that is
    not present in a poor quality design?
  • What is present in a poor quality design that is
    not present in a good quality design?
  • Alexander discovered
  • Good constructs had things in common with each
    other

7
Design Patterns Arose from Architecture and
Anthropology
  • Two porches may
  • appear structurally different
  • solve the same (or similar) problem
  • be considered high quality

8
Design Patterns Arose from Architecture and
Anthropology
  • Alexander narrowed his focus
  • Look at structures that solve similar problems
  • Discern similarities between designs that were
    high quality
  • These similarities are called patterns
  • A solution to a problem in a context
  • Each pattern describes a problem which occurs
    over and over again in our environment and then
    describes the core of the solution to the
    problem, in such a way that you can reuse this
    solution a million times over, without ever doing
    it the same way twice.

9
Design Patterns Arose from Architecture and
Anthropology
  • Four essential items
  • The name of the pattern
  • The purpose of the pattern, the problem it solves
  • How we could accomplish this
  • The constraints and forces we have to consider in
    order to accomplish it
  • Alexander postulated
  • Patterns can solve virtually every architectural
    problem that one will encounter
  • Patterns could be used together to solve complex
    architectural problems

10
Outline
  • Overview
  • Design Patterns Arose from Architecture and
    Anthropology
  • Moving from Architectural to Software Design
    Patterns
  • Why Study Design Patterns?
  • Other Advantages to Studying Design Patterns
  • Summary

11
Moving from Architectural to Software Design
Patterns
  • In the early 1990s, some smart developers
  • Happened upon Alexanders work in patterns
  • Wondered if what was true for architectural
    patterns would also be true for software design?
  • Were there problems in software that occur over
    and over again that could be solved somewhat the
    same manner?
  • Was it possible to design software in terms of
    patterns, creating specific solutions based on
    these patterns only after the patterns had been
    identified?
  • The answer to both of the above questions are
    unequivocally yes.

12
Moving from Architectural to Software Design
Patterns
  • Early work on design patterns
  • Design Patterns Elements of Reusable
    Object-Oriented Software by GoF
  • Identified the patterns ( not create the patterns
    )
  • Served the following purposes
  • It applied the idea of design patterns to
    software design.
  • It described a structure within which to catalog
    and describe design patterns.
  • It cataloged 23 such patterns.
  • It postulated object-oriented strategies and
    approaches based on these design patterns.

13
Key Features of Patterns
14
Outline
  • Overview
  • Design Patterns Arose from Architecture and
    Anthropology
  • Moving from Architectural to Software Design
    Patterns
  • Why Study Design Patterns?
  • Other Advantages to Studying Design Patterns
  • Summary

15
Why Study Design Patterns?
  • Reuse solutions
  • Not have to reinvent solutions for commonly
    recurring problems
  • Establish common terminology
  • A common base of vocabulary
  • A common viewpoint of the problem
  • Give a higher-level perspective
  • On the problem
  • On the process of design and object orientation

16
Why Study Design Patterns?
  • A conversation between two carpenters
  • Carpenter 1 How do you think we should build
    these drawers?
  • Carpenter 2 Well, I think we should make the
    joint by cutting straight down into the wood, and
    then cut back up 45 degrees, and the going
    straight back down, and then back up the other
    way 45 degree, and the going straight back down,
    and then
  • The details may confuse the solution.

17
Why Study Design Patterns?
18
Why Study Design Patterns?
  • Carpenter 1 Should we use a dovetail joint or a
    miter joint?
  • A miter joint
  • It is a simpler solution.
  • It is lightweight.
  • It is inconspicuous.
  • A dovetail joint
  • It is a more complex solution.
  • It is impervious to temperature and humidity.
  • It is independent of the fastening system.
  • It is a more aesthetically pleasing joint.

19
Why Study Design Patterns?
  • Carpenter 1
  • Should we use a dovetail joint or a miter joint?
  • The real question is
  • Should we use a joint that is expensive to make
    but is both beautiful and durable, or should we
    just make a quick and dirty joint that will last
    at least as long until the check clears?
  • Which is more efficient?Who would you rather
    work with?
  • Patterns help raise the level of your thinking
  • See the forest and the trees

20
Outline
  • Overview
  • Design Patterns Arose from Architecture and
    Anthropology
  • Moving from Architectural to Software Design
    Patterns
  • Why Study Design Patterns?
  • Other Advantages to Studying Design Patterns
  • Summary

21
Other Advantages toStudying Design Patterns
  • Experiences from the Author
  • Help both individual learning and team
    development
  • Improve modifiability of code
  • Illustrate basic object-oriented principles
  • Strategies from GoF
  • Design to Interface
  • Favor composition over inheritance
  • Find what varies and encapsulate it

22
Outline
  • Overview
  • Design Patterns Arose from Architecture and
    Anthropology
  • Moving from Architectural to Software Design
    Patterns
  • Why Study Design Patterns?
  • Other Advantages to Studying Design Patterns
  • Summary

23
Summary
  • Reasons for studying design patterns
  • Reuse existing, high-quality solutions to
    commonly recurring problems.
  • Establish common terminology to improve
    communications within teams.
  • Shift the level of thinking to a higher
    perspective.
  • Decide whether I have the right design, not just
    one that works.

24
Summary
  • (cont.)
  • Improve individual learning and team learning.
  • Improve the modifiability of code.
  • Facilitate adoption of improved design
    alternatives, even when patterns are not used
    explicitly.
  • Discover alternatives to large inheritance
    hierarchies.

25
The End
About PowerShow.com