<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Design_Patterns</id>
	<title>Design Patterns - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.sarg.dev/index.php?action=history&amp;feed=atom&amp;title=Design_Patterns"/>
	<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Design_Patterns&amp;action=history"/>
	<updated>2026-04-18T22:09:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.sarg.dev/index.php?title=Design_Patterns&amp;diff=26647&amp;oldid=prev</id>
		<title>imported&gt;Monkbot: /* top */ Monkbot/task 21: Replace page(s) with article-number;</title>
		<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Design_Patterns&amp;diff=26647&amp;oldid=prev"/>
		<updated>2025-09-30T21:01:22Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;top: &lt;/span&gt; &lt;a href=&quot;/index.php?title=User:Monkbot/task_21:_Replace_page(s)_with_article-number&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User:Monkbot/task 21: Replace page(s) with article-number (page does not exist)&quot;&gt;Monkbot/task 21: Replace page(s) with article-number&lt;/a&gt;;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Short description|1994 software engineering book}}&lt;br /&gt;
{{hatnote|This article is about the book. For the generic articles, see [[software design pattern]] and [[design pattern]].}}&lt;br /&gt;
{{cleanup reorganize|date=July 2013}}&lt;br /&gt;
{{Use dmy dates|date=January 2024}}&lt;br /&gt;
{{Use American English|date=January 2024}}&lt;br /&gt;
{{Infobox book&lt;br /&gt;
| name         = Design Patterns:&amp;lt;br /&amp;gt;Elements of Reusable {{nobr|Object-Oriented}} Software&lt;br /&gt;
| image        = Design Patterns cover.jpg&lt;br /&gt;
| author       = {{unbulleted list|[[Erich Gamma]]|[[Richard Helm]]|[[Ralph Johnson (computer scientist)|Ralph Johnson]]|[[John Vlissides]]}}&lt;br /&gt;
| illustrator  =&lt;br /&gt;
| cover_artist =&lt;br /&gt;
| country      = United States&lt;br /&gt;
| subject      = [[Design pattern]]s, [[software engineering]], [[object-oriented programming]]&lt;br /&gt;
| genre        =&lt;br /&gt;
| publisher    = [[Addison-Wesley]]&lt;br /&gt;
| pub_date     = 1994&lt;br /&gt;
| media_type   =&lt;br /&gt;
| pages        = 395&lt;br /&gt;
| isbn         = 0-201-63361-2&lt;br /&gt;
| oclc         = 31171684&lt;br /&gt;
| dewey        = 005.1/2 20&lt;br /&gt;
| congress     = QA76.64 .D47 1995&lt;br /&gt;
}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Design Patterns: Elements of Reusable Object-Oriented Software&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; (1994) is a [[software engineering]] book describing [[software design pattern]]s. The book was written by [[Erich Gamma]], [[Richard Helm]], [[Ralph Johnson (computer scientist)|Ralph Johnson]], and [[John Vlissides]], with a foreword by [[Grady Booch]]. The book is divided into two parts, with the first two chapters exploring the capabilities and pitfalls of [[object-oriented programming]], and the remaining chapters describing 23 classic [[software design pattern]]s. The book includes examples in [[C++]] and [[Smalltalk]].&lt;br /&gt;
&lt;br /&gt;
It has been influential to the field of software engineering and is regarded as an important source for object-oriented design theory and practice. More than 500,000 copies have been sold in English and in 13 other languages.&amp;lt;ref name=&amp;quot;copies-sold&amp;quot;&amp;gt;{{cite book|title=Pro ODP .NET for Oracle Database 11g|first=Edmund|last=Zehoo|editor-first=Edmund|editor-last=Zehoo|date=26 January 2010|publisher=Apress|pages=351–371|via=Springer Link|doi=10.1007/978-1-4302-2821-9_13}}&amp;lt;/ref&amp;gt; The authors are often referred to as the &amp;#039;&amp;#039;Gang of Four&amp;#039;&amp;#039; (GoF).&amp;lt;ref name=&amp;quot;gof1&amp;quot;&amp;gt;{{cite book|title=2017 IEEE International Conference on Software Quality, Reliability and Security (QRS)|doi=10.1109/QRS.2017.37 |s2cid=21343926 |chapter=The Effect of Gang-of-Four Design Patterns Usage on Design Quality Attributes |date=2017 |last1=Hussain |first1=Shahid |last2=Keung |first2=Jacky |last3=Khan |first3=Arif Ali |pages=263–273 |isbn=978-1-5386-0592-9 }}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;gof2&amp;quot;&amp;gt;{{cite book|title=Scala Design Patterns: Patterns for Practical Reuse and Design|first=John|last=Hunt|editor-first=John|editor-last=Hunt|date=26 January 2013|publisher=Springer International Publishing|pages=135–136|via=Springer Link|doi=10.1007/978-3-319-02192-8_16}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;gof3&amp;quot;&amp;gt;{{cite journal|title=Bad Smells of Gang of Four Design Patterns: A Decade Systematic Literature Review|first1=Sara H. S.|last1=Almadi|first2=Danial|last2=Hooshyar|first3=Rodina Binti|last3=Ahmad|date=26 January 2021|journal=Sustainability|volume=13|issue=18|article-number=10256|doi=10.3390/su131810256|bibcode=2021Sust...1310256A |doi-access=free }}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;gof4&amp;quot;&amp;gt;{{cite book|url=https://repositorium.sdum.uminho.pt/handle/1822/752|title=Pitfalls of aspectJ implementations of some of the gang-of-four design patterns|first1=Miguel Pessoa|last1=Monteiro|first2=João M.|last2=Fernandes|date=26 January 2004|publisher=Universidad de Extremadura|isbn=978-84-688-8889-7 |via=repositorium.uminho.pt}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Development and publication history==&lt;br /&gt;
The book started at a birds-of-a-feather session at the 1990 [[OOPSLA]] meeting, &amp;quot;Towards an Architecture Handbook&amp;quot;, where Erich Gamma and Richard Helm met and discovered their common interest. They were later joined by Ralph Johnson and John Vlissides.&amp;lt;ref&amp;gt;[http://c2.com/cgi/wiki?RichardHelm Richard Helm]&amp;lt;/ref&amp;gt; The book was originally published on 21 October 1994, with a 1995 copyright, and was made available to the public at the 1994 OOPSLA meeting.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
{{Overly detailed|section|date=October 2020}}&lt;br /&gt;
&lt;br /&gt;
Chapter 1 is a discussion of [[Object-oriented programming|object-oriented]] design techniques, based on the authors&amp;#039; experience, which they believe would lead to good object-oriented software design, including:&lt;br /&gt;
* &amp;quot;Program to an interface, not an implementation.&amp;quot; (Gang of Four 1995:18)&lt;br /&gt;
* [[Composition over inheritance]]: &amp;quot;Favor &amp;#039;[[object composition]]&amp;#039; over &amp;#039;[[Inheritance (object-oriented programming)|class inheritance]]&amp;#039;.&amp;quot; (Gang of Four 1995:20)&lt;br /&gt;
&lt;br /&gt;
The authors claim the following as advantages of [[Interface (computer science)|interfaces]] over implementation:&lt;br /&gt;
* clients remain unaware of the specific types of objects they use, as long as the object adheres to the interface&lt;br /&gt;
* clients remain unaware of the classes that implement these objects; clients only know about the abstract class(es) defining the interface&lt;br /&gt;
&lt;br /&gt;
Use of an interface also leads to [[Dynamic dispatch|dynamic binding]] and [[Polymorphism (computer science)|polymorphism]], which are central features of object-oriented programming.&lt;br /&gt;
&lt;br /&gt;
The authors refer to [[Inheritance (object-oriented programming)|inheritance]] as &amp;#039;&amp;#039;[[White box (software engineering)|white-box]] reuse&amp;#039;&amp;#039;, with white-box referring to visibility, because the internals of parent classes are often visible to [[Subclass (computer science)|subclasses]]. In contrast, the authors refer to [[object composition]] (in which objects with well-defined interfaces are used dynamically at runtime by objects obtaining references to other objects) as &amp;#039;&amp;#039;[[Black box|black-box]] reuse&amp;#039;&amp;#039; because no internal details of composed objects need be visible in the code using them.&lt;br /&gt;
&lt;br /&gt;
The authors discuss the tension between inheritance and encapsulation at length and state that in their experience, designers overuse inheritance (Gang of Four 1995:20). The danger is stated as follows:&lt;br /&gt;
&lt;br /&gt;
:&amp;quot;Because inheritance exposes a [[Subclass (computer science)|subclass]] to details of its parent&amp;#039;s implementation, it&amp;#039;s often said that &amp;#039;inheritance breaks encapsulation&amp;#039;&amp;quot;. (Gang of Four 1995:19)&lt;br /&gt;
&lt;br /&gt;
They warn that the implementation of a subclass can become so bound up with the implementation of its parent class that any change in the parent&amp;#039;s implementation will force the subclass to change. Furthermore, they claim that a way to avoid this is to inherit only from abstract classes—but then, they point out that there is minimal code reuse.&lt;br /&gt;
&lt;br /&gt;
Using inheritance is recommended mainly when adding to the functionality of existing components, reusing most of the old code and adding relatively small amounts of new code.&lt;br /&gt;
&lt;br /&gt;
To the authors, &amp;#039;delegation&amp;#039; is an extreme form of object composition that can always be used to replace inheritance. Delegation involves two objects: a &amp;#039;sender&amp;#039; passes itself to a &amp;#039;delegate&amp;#039; to let the delegate refer to the sender. Thus the link between two parts of a system are established only at runtime, not at compile-time. The [[Callback (computer science)|Callback]] article has more information about delegation.&lt;br /&gt;
&lt;br /&gt;
The authors also discuss so-called parameterized types, which are also known as [[Generic programming|generics]] ([[Ada (programming language)|Ada]], [[Eiffel (programming language)|Eiffel]], [[Generics in Java|Java]], [[C Sharp (programming language)|C#]], [[Visual Basic (.NET)]], and [[Delphi (software)|Delphi]]) or templates ([[C++]]). These allow any type to be defined without specifying all the other types it uses—the unspecified types are supplied as &amp;#039;parameters&amp;#039; at the point of use.&lt;br /&gt;
&lt;br /&gt;
The authors admit that delegation and parameterization are very powerful but add a warning:&lt;br /&gt;
&lt;br /&gt;
:&amp;quot;Dynamic, highly parameterized software is harder to understand and build than more static software.&amp;quot; (Gang of Four 1995:21)&lt;br /&gt;
&lt;br /&gt;
The authors further distinguish between &amp;#039;[[Object composition#Aggregation|Aggregation]]&amp;#039;, where one object &amp;#039;has&amp;#039; or &amp;#039;is part of&amp;#039; another object (implying that an aggregate object and its owner have identical lifetimes) and acquaintance, where one object merely &amp;#039;knows of&amp;#039; another object. Sometimes acquaintance is called &amp;#039;association&amp;#039; or the &amp;#039;using&amp;#039; relationship. Acquaintance objects may request operations of each other, but they are not responsible for each other. Acquaintance is a weaker relationship than aggregation and suggests much [[Loose coupling|looser coupling]] between objects, which can often be desirable for maximum maintainability in designs.&lt;br /&gt;
&lt;br /&gt;
The authors employ the term &amp;#039;toolkit&amp;#039; where others might today use &amp;#039;class library&amp;#039;, as in C# or Java. In their parlance, toolkits are the object-oriented equivalent of subroutine libraries, whereas a &amp;#039;[[Software framework|framework]]&amp;#039; is a set of cooperating classes that make up a reusable design for a specific class of software. They state that applications are hard to design, toolkits are harder, and frameworks are the hardest to design.&lt;br /&gt;
&lt;br /&gt;
== Patterns by type ==&lt;br /&gt;
&lt;br /&gt;
===Creational===&lt;br /&gt;
{{main|Creational pattern}}&lt;br /&gt;
[[Creational pattern]]s are ones that create objects, rather than having to instantiate objects directly. This gives the program more flexibility in deciding which objects need to be created for a given case.&lt;br /&gt;
* [[Abstract factory pattern|Abstract factory]] groups object factories that have a common theme.&lt;br /&gt;
* [[Builder pattern|Builder]] constructs complex objects by separating construction and representation.&lt;br /&gt;
* [[Factory method pattern|Factory method]] creates objects without specifying the exact class to create.&lt;br /&gt;
* [[Prototype pattern|Prototype]] creates objects by cloning an existing object.&lt;br /&gt;
* [[Singleton pattern|Singleton]] restricts object creation for a class to only one instance.&lt;br /&gt;
&lt;br /&gt;
===Structural===&lt;br /&gt;
[[Structural pattern]]s concern class and object composition. They use inheritance to compose interfaces and define ways to compose objects to obtain new functionality.&lt;br /&gt;
* [[Adapter pattern|Adapter]] allows classes with incompatible interfaces to work together by wrapping its own interface around that of an already existing class.&lt;br /&gt;
* [[Bridge pattern|Bridge]] decouples an abstraction from its implementation so that the two can vary independently.&lt;br /&gt;
* [[Composite pattern|Composite]] composes zero-or-more similar objects so that they can be manipulated as one object.&lt;br /&gt;
* [[Decorator pattern|Decorator]] dynamically adds/overrides behavior in an existing method of an object.&lt;br /&gt;
* [[Facade pattern|Facade]] provides a simplified interface to a large body of code.&lt;br /&gt;
* [[Flyweight pattern|Flyweight]] reduces the cost of creating and manipulating a large number of similar objects.&lt;br /&gt;
* [[Proxy pattern|Proxy]] provides a placeholder for another object to control access, reduce cost, and reduce complexity.&lt;br /&gt;
&lt;br /&gt;
===Behavioral===&lt;br /&gt;
Most [[Behavioral pattern|behavioral design patterns]] are specifically concerned with communication between objects.&lt;br /&gt;
* [[Chain-of-responsibility pattern|Chain of responsibility]] delegates commands to a chain of processing objects.&lt;br /&gt;
* [[Command pattern|Command]] creates objects that encapsulate actions and parameters.&lt;br /&gt;
* [[Interpreter pattern|Interpreter]] implements a specialized language.&lt;br /&gt;
* [[Iterator pattern|Iterator]] accesses the elements of an object sequentially without exposing its underlying representation.&lt;br /&gt;
* [[Mediator pattern|Mediator]] allows [[loose coupling]] between classes by being the only class that has detailed knowledge of their methods.&lt;br /&gt;
* [[Memento pattern|Memento]] provides the ability to restore an object to its previous state (undo).&lt;br /&gt;
* [[Observer pattern|Observer]] is a publish/subscribe pattern, which allows a number of observer objects to see an event.&lt;br /&gt;
* [[State pattern|State]] allows an object to alter its behavior when its internal state changes.&lt;br /&gt;
* [[Strategy pattern|Strategy]] allows one of a family of algorithms to be selected on-the-fly at runtime.&lt;br /&gt;
* [[Template method pattern|Template method]] defines the skeleton of an algorithm as an abstract class, allowing its subclasses to provide concrete behavior.&lt;br /&gt;
* [[Visitor pattern|Visitor]] separates an algorithm from an object structure by moving the hierarchy of methods into one object.&lt;br /&gt;
&lt;br /&gt;
==Reception==&lt;br /&gt;
In 2005 the ACM [[SIGPLAN]] awarded that year&amp;#039;s Programming Languages Achievement Award to the authors, in recognition of the impact of their work &amp;quot;on programming practice and [[programming language]] design&amp;quot;.&amp;lt;ref&amp;gt;{{cite web|url=http://www.sigplan.org/sites/default/files/report2005.pdf|title=SIGPLAN FY &amp;#039;05 Annual Report}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Criticism has been directed at the concept of [[software design pattern]]s generally, and at &amp;#039;&amp;#039;Design Patterns&amp;#039;&amp;#039; specifically. A primary criticism of &amp;#039;&amp;#039;Design Patterns&amp;#039;&amp;#039; is that its patterns are simply workarounds for missing features in C++, replacing elegant abstract features with lengthy concrete patterns, essentially becoming a &amp;quot;human compiler&amp;quot;. [[Paul Graham (programmer)|Paul Graham]] wrote:&amp;lt;ref name = &amp;quot;Graham2002&amp;quot;&amp;gt;{{cite conference&lt;br /&gt;
| last1 = Graham&lt;br /&gt;
| first1 = Paul&lt;br /&gt;
| author1-link = Paul Graham (computer programmer)&lt;br /&gt;
| year = 2002&lt;br /&gt;
| title = Revenge of the Nerds&lt;br /&gt;
| url = http://www.paulgraham.com/icad.html&lt;br /&gt;
| access-date = 11 August 2012}}&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
{{Quote|text=When I see patterns in my programs, I consider it a sign of trouble. The shape of a program should reflect only the problem it needs to solve. Any other regularity in the code is a sign, to me at least, that I&amp;#039;m using abstractions that aren&amp;#039;t powerful enough-- often that I&amp;#039;m generating by hand the expansions of some macro that I need to write.}}&lt;br /&gt;
&lt;br /&gt;
[[Peter Norvig]] demonstrates that 16 out of the 23 patterns in &amp;#039;&amp;#039;Design Patterns&amp;#039;&amp;#039; are simplified or eliminated by language features in [[Lisp (programming language)|Lisp]] or [[Dylan (programming language)|Dylan]].&amp;lt;ref name = &amp;quot;Norvig1998&amp;quot;&amp;gt;{{cite conference&lt;br /&gt;
| last1 = Norvig&lt;br /&gt;
| first1 = Peter&lt;br /&gt;
| author1-link = Peter Norvig&lt;br /&gt;
| year = 1998&lt;br /&gt;
| title = Design Patterns in Dynamic Languages&lt;br /&gt;
| url = http://www.norvig.com/design-patterns/&lt;br /&gt;
}}&amp;lt;/ref&amp;gt; Related observations were made by Hannemann and [[Gregor Kiczales|Kiczales]] who implemented several of the 23 design patterns using an [[aspect-oriented programming]] language ([[AspectJ]]) and showed that code-level dependencies were removed from the implementations of 17 of the 23 design patterns and that aspect-oriented programming could simplify the implementations of design patterns.&amp;lt;ref name = &amp;quot;Hannemann 2002&amp;quot;&amp;gt;{{cite conference&lt;br /&gt;
| last1 = Hannemann&lt;br /&gt;
| first1 = Jan&lt;br /&gt;
| year = 2002&lt;br /&gt;
| title = Design pattern implementation in Java and AspectJ&lt;br /&gt;
| url = http://hannemann.pbworks.com/w/page/16577895/Design%20Pattern&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In an interview with InformIT in 2009, Erich Gamma stated that the book authors had a discussion in 2005 on how they would have refactored the book and concluded that they would have recategorized some patterns and added a few additional ones, such as extension object/interface, dependency injection, type object, and null object. Gamma wanted to remove the singleton pattern, but there was no consensus among the authors to do so.&amp;lt;ref&amp;gt;{{cite interview |last1=Gamma |first1=Erich |last2=Helm |first2=Richard |last3=Johnson |first3=Ralph |interviewer=Larry O&amp;#039;Brien |date=22 October 2009 |title=Design Patterns 15 Years Later: An Interview with Erich Gamma, Richard Helm, and Ralph Johnson |url=http://www.informit.com/articles/article.aspx?p=1404056 |work=InformIT |access-date=1 September 2019 |archive-url=https://web.archive.org/web/20190220090254/http://www.informit.com/articles/article.aspx?p=1404056 |archive-date=20 February 2019 |url-status=live}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Software design pattern]]&lt;br /&gt;
* [[Enterprise Integration Patterns]]&lt;br /&gt;
* [[GRASP (object-oriented design)]]&lt;br /&gt;
* [[Pedagogical pattern]]s&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
&lt;br /&gt;
{{Design patterns}}&lt;br /&gt;
&lt;br /&gt;
{{DEFAULTSORT:Design Patterns (Book)}}&lt;br /&gt;
[[Category:Software engineering books]]&lt;br /&gt;
[[Category:Software design patterns]]&lt;br /&gt;
[[Category:1994 non-fiction books]]&lt;br /&gt;
[[Category:Addison-Wesley books]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Monkbot</name></author>
	</entry>
</feed>