SlideShare a Scribd company logo
Twenty-one Years of Design
Patterns
Ralph E. Johnson
rjohnson.uiuc@gmail.com
Design Patterns: Elements of Reusable
Object-Oriented Design by Erich
Gamma, Richard Helm, Ralph Johnson
and John Vlissides, 1995.
Released in October 1994 at OOPSLA.
Jolt Award, Dr. Dobbs Journal award,
SIGPLAN Programming Languages
award, SIGSOFT Software Engineering
award, Aito Dahl-Nygard Prize
Other books
• The Design Patterns Smalltalk
Companion, Alpert, Brown and Woolf
• Heads First Design Patterns, Freeman,
Freeman, Bates and Sierra.
• Domain Driven Design, Eric Evans
• Patterns of Enterprise Application
Architecture, Fowler et. al.
• http://hillside.net/patterns/books
• Describes 23 object-oriented design
patterns
• Typical of advanced object-oriented
programming
• Provides a design vocabulary
– Learning
– Communication
– Design
Core patterns
• Mediator
• Façade
• Proxy
• Command
• Template Method
• Adapter
• Null Object
• Composite
• Strategy
• Decorator
• State
• Iterator
• Observer
• Value Object
Composite
• Idea: make abstract "component" class.
• Alternative 1: every component has a
(possibly empty) set of components.
• Problem: many components have no
components.
Component
Children
ParagraphChapter ...
*
Composite Pattern
Component
container
childrenDo:
CompositeLeaf
Composite and Component
have the exact same
interface.
• enumerating children
• childrenDo: for
Component does
nothing
• only Composite adds
removes children.
1-N
Observer Pattern
Observer
update:
Subject
addDependent:
removeDependent:
changed:
Mobster
robBank
driveCar
FBIAgent
update:
observer/
dependent
model
1-N
Listening instead of Observing
• Argument to “update” is an Event
• Many kinds of EventListeners, each
with their own interface
• An EventListener interface can have
more than one update method
Different Kinds of Listeners
• ActionListener
– actionPerformed(ActionEvent)
• ComponentListener
– componentResized(ComponentEvent)
– componentMoved(ComponentEvent)
– componentShown(ComponentEvent)
– componentHidden(ComponentEvent)
• PropertyChangeListener
– propertyChange(PropertyChangeEvent)
From the book …
Avoiding observer-specific update protocols: the push and
pull models. Implementations of the Observer pattern
often have the subject broadcast additional information
about the change. The subject passes this information as
an argument to Update. The amount of information may
vary widely.
…
The pull model emphasizes the subject’s ignorance of its
observers, whereas the push model assumes subjects
know something about their observers’ needs. The push
model might make observers less reusable, because
Subject classes make assumptions about Observer classes
that might not always be true.
Data Binding
• Implement the model as a composite
model.
• Primitives are properties, lists, etc.
• Model does not “assign to variable”, but
“sets value of property”.
• Results: Observers are reusable, don’t
have to invoke update events explicitely
Value Object
• Immutable object - variables set only by
constructor
• Equality is important, not identity
• Lack of side effects - easier to make
correct
Null Object
if (obj == NULL) error(‘null pointer’);
else obj->f();
-----------------------
obj->f();
Give an interface to “null”, make a version
of null for any interface. Eliminate
checking.
Null Object
NullPart
Part
PartDecoratorCompositePart
1-N
Dangerous Patterns
• Mediator
– Supposed to be used to allow colleagues to
be reusable. Is often used to allow
programmers to continue to be procedural.
• Singleton
– Supposed to be used to encapsulate global
state when it cannot be eliminated. Is often
used as a justification of global state.
Creational
• Abstract factory (peripheral)
• Factory method
• Prototype
• Builder
• Singleton
• Dependency Injection
Peripheral
• Memento
• Chain of responsibility
• Bridge
• Visitor
• Type Object
• Extension Object
• Generation Gap
Compound
• Flyweight
– To save space, factor out a Value Object, and create
them using a Memoizing Factory that records the
flyweight pool.
• Interpreter
– Represent a program with a Composite, and let the
class hierarchy match the grammar of the language.
Define an “interpret” method in each class.
Issues: Design
• Refactor to patterns
• Patterns not measure of goodness
• Patterns used for
– Variability management
– Decoupling
– Dependence management
• Patterns a means to an end, not the end
Ways to improve
• Patterns are examples of principles
• Patterns are part of overall design style
– Pattern language
– Evolving Frameworks
– http://st-
www.cs.uiuc.edu/~droberts/evolve.html
Conclusion
• We could have done better.
• But we did pretty well!
• For more info on patterns, including
conferences and publications, see
http://hillside.net
• rjohnson.uiuc@gmail.com

More Related Content

KEY
Draper presentation
PPTX
Object oriented design
PDF
JDD2015: ClassIndex - szybka alternatywa dla skanowania klas - Sławek Piotrowski
PPTX
JDD2015: Piękny Pan od HR radzi, czyli 1011 błędów, które popełniają programi...
PDF
JDD2015: Z czym mierzą się zespoły? - Michał Bartyzel
PDF
JDD2015: Logowanie zdarzeń w architekturze opartej na mikroserwisach - Paweł ...
PDF
JDD2015: Kubernetes - Beyond the basics - Paul Bakker
PDF
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba
Draper presentation
Object oriented design
JDD2015: ClassIndex - szybka alternatywa dla skanowania klas - Sławek Piotrowski
JDD2015: Piękny Pan od HR radzi, czyli 1011 błędów, które popełniają programi...
JDD2015: Z czym mierzą się zespoły? - Michał Bartyzel
JDD2015: Logowanie zdarzeń w architekturze opartej na mikroserwisach - Paweł ...
JDD2015: Kubernetes - Beyond the basics - Paul Bakker
Lightning Talk #9: How UX and Data Storytelling Can Shape Policy by Mika Aldaba

Similar to JDD2015: Twenty-one years of "Design Patterns" - Ralph Johnson (20)

PPT
Object oriented analysis & Design- Overview
PPT
Object Oriented Analysis and Design - Overview
PPT
Object Oriented PHP Overview
PPTX
Software enginering.group-no-11 (1)
PPT
10-design-patterns1.ppt.software engineering
PPT
History of Object Orientation in OOP.ppt
PPT
History of Object Orientation in OOP.ppt
PPTX
Introduction to Software - Coder Forge - John Mulhall
PPTX
SKILLWISE - OOPS CONCEPT
PPTX
Attain Clean Code in Sitecore Solutions using Design Patterns
PPTX
Online TechTalk  "Patterns in Embedded SW Design"
PPT
Design Patterns.ppt
PPTX
Design p atterns
KEY
ZendCon 2011 UnCon Domain-Driven Design
PPTX
Design Pattern lecture 2
PPTX
Decorator Pattern
PPT
5-CEN6016-Chapter1.ppt
PPTX
UNIT IV DESIGN PATTERNS.pptx
PPT
Design patterns represent the best practices used by experienced object-orien...
PPT
10-DesignPatterns.ppt
Object oriented analysis & Design- Overview
Object Oriented Analysis and Design - Overview
Object Oriented PHP Overview
Software enginering.group-no-11 (1)
10-design-patterns1.ppt.software engineering
History of Object Orientation in OOP.ppt
History of Object Orientation in OOP.ppt
Introduction to Software - Coder Forge - John Mulhall
SKILLWISE - OOPS CONCEPT
Attain Clean Code in Sitecore Solutions using Design Patterns
Online TechTalk  "Patterns in Embedded SW Design"
Design Patterns.ppt
Design p atterns
ZendCon 2011 UnCon Domain-Driven Design
Design Pattern lecture 2
Decorator Pattern
5-CEN6016-Chapter1.ppt
UNIT IV DESIGN PATTERNS.pptx
Design patterns represent the best practices used by experienced object-orien...
10-DesignPatterns.ppt
Ad

Recently uploaded (20)

PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
PDF
17 Powerful Integrations Your Next-Gen MLM Software Needs
PDF
Digital Systems & Binary Numbers (comprehensive )
PPTX
Transform Your Business with a Software ERP System
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
Patient Appointment Booking in Odoo with online payment
PDF
AutoCAD Professional Crack 2025 With License Key
PPTX
history of c programming in notes for students .pptx
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Complete Guide to Website Development in Malaysia for SMEs
PDF
Designing Intelligence for the Shop Floor.pdf
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Computer Software and OS of computer science of grade 11.pptx
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
17 Powerful Integrations Your Next-Gen MLM Software Needs
Digital Systems & Binary Numbers (comprehensive )
Transform Your Business with a Software ERP System
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Reimagine Home Health with the Power of Agentic AI​
Patient Appointment Booking in Odoo with online payment
AutoCAD Professional Crack 2025 With License Key
history of c programming in notes for students .pptx
Operating system designcfffgfgggggggvggggggggg
CHAPTER 2 - PM Management and IT Context
Navsoft: AI-Powered Business Solutions & Custom Software Development
Design an Analysis of Algorithms I-SECS-1021-03
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Complete Guide to Website Development in Malaysia for SMEs
Designing Intelligence for the Shop Floor.pdf
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Ad

JDD2015: Twenty-one years of "Design Patterns" - Ralph Johnson

  • 1. Twenty-one Years of Design Patterns Ralph E. Johnson [email protected]
  • 2. Design Patterns: Elements of Reusable Object-Oriented Design by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, 1995. Released in October 1994 at OOPSLA. Jolt Award, Dr. Dobbs Journal award, SIGPLAN Programming Languages award, SIGSOFT Software Engineering award, Aito Dahl-Nygard Prize
  • 3. Other books • The Design Patterns Smalltalk Companion, Alpert, Brown and Woolf • Heads First Design Patterns, Freeman, Freeman, Bates and Sierra. • Domain Driven Design, Eric Evans • Patterns of Enterprise Application Architecture, Fowler et. al. • http://hillside.net/patterns/books
  • 4. • Describes 23 object-oriented design patterns • Typical of advanced object-oriented programming • Provides a design vocabulary – Learning – Communication – Design
  • 5. Core patterns • Mediator • Façade • Proxy • Command • Template Method • Adapter • Null Object • Composite • Strategy • Decorator • State • Iterator • Observer • Value Object
  • 6. Composite • Idea: make abstract "component" class. • Alternative 1: every component has a (possibly empty) set of components. • Problem: many components have no components. Component Children ParagraphChapter ... *
  • 7. Composite Pattern Component container childrenDo: CompositeLeaf Composite and Component have the exact same interface. • enumerating children • childrenDo: for Component does nothing • only Composite adds removes children. 1-N
  • 9. Listening instead of Observing • Argument to “update” is an Event • Many kinds of EventListeners, each with their own interface • An EventListener interface can have more than one update method
  • 10. Different Kinds of Listeners • ActionListener – actionPerformed(ActionEvent) • ComponentListener – componentResized(ComponentEvent) – componentMoved(ComponentEvent) – componentShown(ComponentEvent) – componentHidden(ComponentEvent) • PropertyChangeListener – propertyChange(PropertyChangeEvent)
  • 11. From the book … Avoiding observer-specific update protocols: the push and pull models. Implementations of the Observer pattern often have the subject broadcast additional information about the change. The subject passes this information as an argument to Update. The amount of information may vary widely. … The pull model emphasizes the subject’s ignorance of its observers, whereas the push model assumes subjects know something about their observers’ needs. The push model might make observers less reusable, because Subject classes make assumptions about Observer classes that might not always be true.
  • 12. Data Binding • Implement the model as a composite model. • Primitives are properties, lists, etc. • Model does not “assign to variable”, but “sets value of property”. • Results: Observers are reusable, don’t have to invoke update events explicitely
  • 13. Value Object • Immutable object - variables set only by constructor • Equality is important, not identity • Lack of side effects - easier to make correct
  • 14. Null Object if (obj == NULL) error(‘null pointer’); else obj->f(); ----------------------- obj->f(); Give an interface to “null”, make a version of null for any interface. Eliminate checking.
  • 16. Dangerous Patterns • Mediator – Supposed to be used to allow colleagues to be reusable. Is often used to allow programmers to continue to be procedural. • Singleton – Supposed to be used to encapsulate global state when it cannot be eliminated. Is often used as a justification of global state.
  • 17. Creational • Abstract factory (peripheral) • Factory method • Prototype • Builder • Singleton • Dependency Injection
  • 18. Peripheral • Memento • Chain of responsibility • Bridge • Visitor • Type Object • Extension Object • Generation Gap
  • 19. Compound • Flyweight – To save space, factor out a Value Object, and create them using a Memoizing Factory that records the flyweight pool. • Interpreter – Represent a program with a Composite, and let the class hierarchy match the grammar of the language. Define an “interpret” method in each class.
  • 20. Issues: Design • Refactor to patterns • Patterns not measure of goodness • Patterns used for – Variability management – Decoupling – Dependence management • Patterns a means to an end, not the end
  • 21. Ways to improve • Patterns are examples of principles • Patterns are part of overall design style – Pattern language – Evolving Frameworks – http://st- www.cs.uiuc.edu/~droberts/evolve.html
  • 22. Conclusion • We could have done better. • But we did pretty well! • For more info on patterns, including conferences and publications, see http://hillside.net • [email protected]