Thinking in C++ Vol 2 - Practical Programming |
Prev |
Home |
Next |
GoF discusses 23 patterns, classified under three purposes
(all of which revolve around the particular aspect that can vary):
1. Creational: How an object can be created. This often
involves isolating the details of object creation so your code isn t dependent
on what types of objects there are and thus doesn t have to be changed when you
add a new type of object. This chapter introduces Singleton, Factories, and
Builder.
2. Structural: These affect the way objects are connected
with other objects to ensure that changes in the system don t require changes
to those connections. Structural patterns are often dictated by project
constraints. In this chapter you ll see Proxy and Adapter.
3. Behavioral: Objects that handle particular types of
actions within a program. These encapsulate processes that you want to perform,
such as interpreting a language, fulfilling a request, moving through a
sequence (as in an iterator), or implementing an algorithm. This chapter
contains examples of Command, Template Method, State, Strategy, Chain of
Responsibility, Observer, Multiple Dispatching, and Visitor.
GoF includes a section on each of its 23 patterns along with
one or more examples of each, typically in C++ but sometimes in Smalltalk. This
book will not repeat the details of the patterns shown in GoF since that book
stands on its own and should be studied separately. The description and
examples provided here are intended to give you a grasp of the patterns, so you
can get a feel for what patterns are about and why they are important.
Thinking in C++ Vol 2 - Practical Programming |
Prev |
Home |
Next |