0% found this document useful (0 votes)
152 views

What Is A Pattern?: Aleksandra Tesanovic

This document defines and discusses the concept of patterns in software design. It provides a brief history of patterns, defines what patterns are, describes their key properties and types, and discusses how patterns can be described and organized into languages, catalogs, and systems. The document also outlines how an object-oriented application can be reorganized using design patterns.

Uploaded by

Vanshika Dogra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
152 views

What Is A Pattern?: Aleksandra Tesanovic

This document defines and discusses the concept of patterns in software design. It provides a brief history of patterns, defines what patterns are, describes their key properties and types, and discusses how patterns can be described and organized into languages, catalogs, and systems. The document also outlines how an object-oriented application can be reorganized using design patterns.

Uploaded by

Vanshika Dogra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 19

What is a pattern?

Aleksandra Tesanovic
Real-Time Systems Laboratory
Department of Computer and Information Science
Linköpings universitet
Sweden

What is a pattern? September, 2001


Talk outline

• Pattern origins and history

• Definition

• Properties

• Types of patterns

• Describing design patterns

• Pattern language, system, catalog

• Reorganizing an object-oriented application using design


patterns

What is a pattern? September, 2001


Pattern origins and history

• writings of architect Christopher Alexander


(coined this use of the term "pattern" ca. 1977-1979)
• Kent Beck and Ward Cunningham, Textronix, OOPSLA'87
(used Alexander's "pattern" ideas for Smalltalk GUI design)
• Erich Gamma, Ph. D. thesis, 1988-1991
• James Coplien, Advanced C++ Idioms book, 1989-1991
• Gamma, Helm, Johnson, Vlissides ("Gang of Four“ - GoF)
Design Patterns: Elements of Reusable Object-Oriented
Software, 1991-1994
• PLoP Conferences and books, 1994-present
• Buschmann, Meunier, Rohnert, Sommerland, Stal, Pattern -
Oriented Software Architecture: A System of Patterns
(“POSA book”)

What is a pattern? September, 2001


Definition
• … a fully realized form, original, or model accepted or
proposed for imitation…[dictionary]

• ... describes a problem which occurs over and over again in


our environment, and then describes the core of the
solution to that problem, in such a way that you can use this
solution a million times over, without ever doing it the same
way twice [Alexander]

• … the abstraction from a concrete form which keeps


recurring in specific non-arbitrary contexts [Riehle]

• …both a thing and the instructions for making the thing


[Coplien]

• ...a literary format for capturing the wisdom and experience


of expert designers, and communicating it to novices
What is a pattern? September, 2001
Properties

Patterns do...
• provide common vocabulary
• provide “shorthand” for effectively communicating complex
principles
• help document software architecture
• capture essential parts of a design in compact form
• show more than one solution
• describe software abstractions

Patterns do not...
• provide an exact solution
• solve all design problems
• only apply for object-oriented design

What is a pattern? September, 2001


Patterns can be

• non-generative (Gamma patterns)


– observed in a system
– descriptive and passive

• generative
– generate systems or pats of systems
– perspective and active

What is a pattern? September, 2001


Ingredients
Pattern
Context
a design situation giving rise to a design problem
Problem
a set of forces occuring in that context
Solution
a form or rule that can be applied to resolve these forces

Example – window place


• forces
– he wants to sit down and be comfortable
– he is drawn toward the light
• solution
– in every room, make at least one window into a “window place”

What is a pattern? September, 2001


Types of software patterns

• design patterns (software design)


[Buschmann-POSA]
– architectural (systems design)
– design (micro-architectures) [Gamma-GoF]
– idioms (low level)

• analysis patterns (recurring & reusable analysis models) [Flower]


• organization patterns (structure of organizations/projects)
• process patterns (software process design)
• domain-specific patterns

What is a pattern? September, 2001


Alexandrian form (canonical form)

Name
meaningful name
Problem
the statement of the problem
Context
a situation giving rise to a problem
Forces
a description of relevant forces and constraints
Solution
proven solution to the problem
Examples
sample applications of the pattern
Resulting context (force resolution)
the state of the system after pattern has been applied

What is a pattern? September, 2001


Alexandrian form (canonical form)

Rationale
explanation of steps or rules in the pattern
Related patterns
static and dynamic relationship
Known use
occurrence of the pattern and its application within existing
system

What is a pattern? September, 2001


GoF format

Pattern name and classification


Intent
what does pattern do / when the solution works
Also known as
other known names of pattern (if any)
Motivation
the design problem / how class and object structures solve
the problem
Applicability
situations where pattern can be applied
Structure
a graphical representation of classes in the pattern
Participants
the classes/objects participating and their responsibilities
Collaborations
of the participants to carry out responsibilities

What is a pattern? September, 2001


GoF format

Consequences
trade-offs, concerns
Implementation
hints, techniques
Sample code
code fragment showing possible implementation
Known uses
patterns found in real systems
Related patterns
closely related patterns

What is a pattern? September, 2001


Pattern templates
[PATTERN-NAME]
Author
[YOUR-NAME] ([[email protected]]).
Last updated on [TODAY'S-DATE]
Context
[PARAG-1] IF you find yourself in CONTEXT
[PARAG-2] for example EXAMPLES,
Problem with PROBLEM,
[ONE-ASPECT] entailing FORCES
[ANOTHER-ASPECT] THEN for some REASONS,
Examples apply DESIGN FORM AND/OR RULE
Forces to construct SOLUTION
1.[FORCE-1]
2.[FORCE-2] leading to NEW CONTEXT and OTHER PATTERNS
Design
[PARAG-1]
[PARAG-2]
An Implementation
[SOME-CODE]
Examples http://hillside.net/patterns/Writing/Lea.html
Variants
[VARIANT]
[ANOTHER-VARIANT]
More pattern templates:
See Also •http://hillside.net/patterns/template.html
[ANOTHER-REF]
•http://www.paterndepot.com/pages (Templates)
What is a pattern? September, 2001
Pattern language

[Coplien]
• …is a structured collection of patterns that build on each
other to transform needs and constraints into an
architecture [Software Design Patterns: Common Questions and Answers]

• …defines collection of patterns and rules to combine them


into an architectural style…describe software frameworks or
families of related systems [Patterns Home Page ->Patterns Definitions]

What is a pattern? September, 2001


Pattern catalogs and systems

[Buschmann, POSA]
• pattern catalog
…a collection of related patterns, where patterns are
subdivided into small number of broad categories…

• pattern system
…a cohesive set of related patterns, which work together to
support the construction and evolution of hole
architectures...

What is a pattern? September, 2001


Design pattern catalog - GoF
Purpose

Creational Structural Behavioral

Class  Factory Method  Adapter  Interperter

 Abstract  Adapter  Chain of Responsibility


Factory  Bridge  Command
 Builder  Composite  Iterator
Scope  Prototype  Decorator  Mediator
Object  Singleton  Facade  Momento
 Flyweight  Observer
 Proxy  State
 Strategy
 Vistor

What is a pattern? September, 2001


Reorganization using patterns

• Experiences using Design Patterns to Reorganize an Object-


Oriented Application, Walter Zimmer
• hypermedia application
– developed by the European Museum Network (EMN)
– on top of MacApp
– 50 classes
• goal of reorganization
– eliminate deficiencies in the design and implementation
Application
specific parts Reorganized
hypermedia
Existing application
hypermedia
application Reusable
Generic, framework
reusable parts layer

MacApp MacApp
What is a pattern? September, 2001
Steps in reorganization

PRELIMINARY STEPS
1 documentation
2 finding staring points
– identification of classes / subsystems design patterns
with design goals similar to ones of parts of the system
design patterns
– experiences and future scenarios
– metrics / design rules critical application parts
– analyzing the application for and their deficiencies
existing patterns
REOGANIZATIONAL STEPS
1 finding and exploring suitable design patterns
2 reconstructing and documentation
– application classes corresponding to the design pattern
– incorporate names of the application classes to the classes in the
design pattern (e.g., LinkStrategy, HyperMediaDecorator)
What is a pattern? September, 2001
Results and experiences

RESULTS
• drastic reduction of dependencies between subsystems
• short design documentation

EXPERIENCES
• common vocabulary - main advantage
• reorganization is time-intensive task
• good knowledge of design patterns needed
• combination of several design patterns required

What is a pattern? September, 2001

You might also like