Patterns in Software Design
-
Upload
yuli-morris -
Category
Documents
-
view
32 -
download
0
description
Transcript of Patterns in Software Design
1© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Patterns in Software Patterns in Software DesignDesign
2© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
ObjectivesObjectives
To explain why design patterns are important
To define software design patterns To present a taxonomy of design
patterns based on their granularity To discuss pattern catalogs
3© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
TopicsTopics
Why design patterns are important
Christopher AlexanderSoftware design patternsPattern granularityPattern catalogs
4© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Why Design Patterns?Why Design Patterns?
Expert designers behave differently from novices—what do experts know that novices do not?
Among other things, experts have a store of successful design patterns from past experience that they apply to new problems.
5© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
More Pattern More Pattern AdvantagesAdvantages
Promoting communication—Pattern names and knowledge of advantages and disadvantages speeds communication
Streamlining documentation—Pattern form and behavior need not be elaborated
Increasing efficiency—Tool support for patterns makes development faster
Supporting reuse—Patterns and their implementations can be reused extensively
Providing ideas—Patterns can be the starting point for design or a basis for improvements
6© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Design Patterns in Design Patterns in Building ArchitectureBuilding Architecture
In the 1970s architect Christopher Alexander introduced a new approach to building design based on design patterns.
Alexander argued that• patterns are consequences of human
anatomy, psychology, physiology, sociology, and politics;
• great architecture has always relied on patterns, but they have never been studied systematically; and
• anyone can make great buildings once the patterns are known and understood.
7© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Examples of Alexander’s Examples of Alexander’s PatternsPatterns
Scattered Work—Use laws and incentives to encourage work places throughout a city.
Four-Story Limit—In an urban area, keep most buildings four stories high or less.
South Facing Outdoors—Always build structures north of the outdoor spaces that go with them.
Warm Colors—Choose light and surface colors to achieve a yellow-red light tone in a room.
8© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Results of Alexander’s Results of Alexander’s WorkWork
Alexander’s work has not been widely accepted among building architects, and his efforts to get non-professionals to design great buildings have often failed, as he himself admits.
But Alexander has inspired a community of software developers to generate work in design patterns.
9© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Design Patterns Design Patterns DefinedDefined
A pattern is a model proposed for imitation. A software design
pattern is a model proposed for imitation in solving a software
design problem.
A pattern is a model proposed for imitation. A software design
pattern is a model proposed for imitation in solving a software
design problem.
The pattern community generally prefers a more complex definition of patterns involving context, resolved forces, etc.
10© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Design Pattern Design Pattern GranularityGranularity
Software design patterns have no inherent granularity.•Architectural styles or patterns are for
entire systems and sub-systems.•Design patterns proper involve several
interacting functions or classes.•Data structures & algorithms are low-
level patterns.•Idioms are ways of doing things in
particular programming languages.
11© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Pattern CatalogsPattern Catalogs
Realization of the importance of design patterns has spurred creation of catalogs of patterns.
These are much like the pattern books used in building architecture or interior design and the handbooks used in engineering.
We will consider a small collection of patterns, presenting our own catalog.
12© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
SummarySummary
Design patterns capture expertise and make it available to novices and experts, providing many advantages.
Design patterns are models propose for imitation in solving software design problems.
Patterns come in various granularities including architectural styles, mid-level design patterns, data structures and algorithms, and programming language idioms.