Guest User

Untitled

a guest
Jun 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.74 KB | None | 0 0
  1. In the scope of "Gang of Four" book patterns split up on three categories by their purpose: *creational*, *structural*,
  2. and *behavioral*. And also pattens split up by criterion, called scope, specifies whether the pattern applies primarily to
  3. classes or to objects.
  4.  
  5. **Page 22.:**
  6.  
  7. Class patterns deal with relationships between classes and their subclasses. These
  8. relationships are established through inheritance, so they are static—
  9. fixed at compile-time. Object patterns deal with object relationships, which can be
  10. changed at run-time and are more dynamic. Almost all patterns use inheritance to some
  11. extent. So the only patterns labeled "class patterns" are those that focus on class
  12. relationships. Note that most patterns are in the Object scope.
  13.  
  14. ## Creational patterns
  15.  
  16. Creational patterns concern the process of object creation.
  17.  
  18. #### Scope: Class
  19.  
  20. **Factory Method :: Page 107**
  21.  
  22. Define an interface for creating an object, but let subclasses decide which class
  23. to instantiate. Factory Method lets a class defer instantiation to subclasses.
  24.  
  25. #### Scope: Objects
  26.  
  27. **pattern name: Abstract Factory :: Page 87**
  28.  
  29. Provide an interface for creating families of related or dependent objects without
  30. specifying their concrete classes.
  31.  
  32. **pattern name: Builder :: Page 97**
  33.  
  34. Separate the construction of a complex object from its representation so that the
  35. same construction process can create different representations.
  36.  
  37. **pattern name: Prototype :: Page 117**
  38.  
  39. Specify the kinds of objects to create using a prototypical instance, and create
  40. new objects by copying this prototype.
  41.  
  42. **pattern name: Singleton :: Page 127**
  43.  
  44. Ensure a class only has one instance, and provide a global point of access to it.
  45.  
  46.  
  47. ## Structural patterns
  48.  
  49. Structural patterns deal with the composition of classes or objects.
  50.  
  51. #### Scope: Class
  52. Null
  53.  
  54. #### Scope: Objects
  55.  
  56. **pattern name: Adapter :: Page 139**
  57.  
  58. Convert the interface of a class into another interface clients expect.
  59. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.
  60.  
  61. **pattern name: Bridge :: Page 151**
  62.  
  63. Decouple an abstraction from its implementation so that the two can vary independently.
  64.  
  65. **pattern name: Composite :: Page 163**
  66.  
  67. Compose objects into tree structures to represent part-whole hierarchies.
  68. Composite lets clients treat individual objects and compositions of objects
  69. uniformly.
  70.  
  71. **pattern name: Decorator :: Page 175**
  72.  
  73. Attach additional responsibilities to an object dynamically. Decorators provide a
  74. flexible alternative to subclassing for extending functionality.
  75.  
  76. ## Behavioral patterns
  77. Behavioral patterns characterize the ways in which classes or objects interact and distribute responsibility.
  78.  
  79. #### Scope: Class
  80.  
  81. **pattern name: Interpreter :: Page 243**
  82.  
  83. Given a language, define a represention for its grammar along with an
  84. interpreter that uses the representation to interpret sentences in the language.
  85.  
  86. **pattern name: Template Method :: Page 325**
  87.  
  88. Define the skeleton of an algorithm in an operation, deferring some steps to
  89. subclasses. Template Method lets subclasses redefine certain steps of an
  90. algorithm without changing the algorithm's structure.
  91.  
  92. #### Scope: Objects
  93.  
  94. **pattern name: Chain of Responsibility :: Page 223**
  95.  
  96. Avoid coupling the sender of a request to its receiver by giving more than one object a
  97. chance to handle the request. Chain the receiving objects and pass the request along
  98. the chain until an object handles it.
  99.  
  100. **pattern name: Command :: Page 233**
  101.  
  102. Encapsulate a request as an object, thereby letting you parameterize clients with
  103. different requests, queue or log requests, and support undoable operations.
  104.  
  105. **pattern name: Facade :: Page 185**
  106.  
  107. Provide a unified interface to a set of interfaces in a subsystem. Facade defines a
  108. higher-level interface that makes the subsystem easier to use.
  109.  
  110.  
  111. **pattern name: Flyweight :: Page 195**
  112.  
  113. Use sharing to support large numbers of fine-grained objects efficiently.
  114.  
  115. **pattern name: Iterator :: Page 257**
  116.  
  117. Provide a way to access the elements of an aggregate object sequentially without
  118. exposing its underlying representation.
  119.  
  120. **pattern name: Mediator :: Page 273**
  121.  
  122. Define an object that encapsulates how a set of objects interact. Mediator
  123. promotes loose coupling by keeping objects from referring to each other
  124. explicitly, and it lets you vary their interaction independently.
  125.  
  126. **pattern name: Memento :: Page 283**
  127.  
  128. Without violating encapsulation, capture and externalize an object's internal
  129. state so that the object can be restored to this state later.
  130.  
  131. **pattern name: Observer :: Page 293**
  132.  
  133. Define a one-to-many dependency between objects so that when one object
  134. changes state, all its dependents are notified and updated automatically.
  135.  
  136. **pattern name: Proxy :: Page 207**
  137.  
  138. Provide a surrogate or placeholder for another object to control access to it.
  139.  
  140. **pattern name: State :: Page 305**
  141.  
  142. Allow an object to alter its behavior when its internal state changes. The object
  143. will appear to change its class.
  144.  
  145. **pattern name: Strategy :: Page 315**
  146.  
  147. Define a family of algorithms, encapsulate each one, and make them
  148. interchangeable. Strategy lets the algorithm vary independently from clients that
  149. use it.
  150.  
  151. **pattern name: Visitor :: Page 331**
  152.  
  153. Represent an operation to be performed on the elements of an object structure.
  154. Visitor lets you define a new operation without changing the classes of the
  155. elements on which it operates.
Add Comment
Please, Sign In to add comment