23.07.2012 Views

Design Patterns Explained

Design Patterns Explained

Design Patterns Explained

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PART V<br />

Handling Variations with<br />

<strong>Design</strong> <strong>Patterns</strong><br />

Part Overview<br />

In this part, I work through another case study. In this case study, I In this part<br />

will consider the requirements for the problem one at a time, rather<br />

than specifying every requirement up front. I will describe a system<br />

that is currently working when a new requirement comes in that<br />

forces me to find the best way to modify the code. I will use this<br />

process to present a few new design patterns— one for each new<br />

requirement.<br />

Chapter Discusses These Topics<br />

14 The Strategy pattern: How to handle varying algorithms and<br />

business rules.<br />

15 The Decorator pattern: How to dynamically add behavior<br />

before or after an object's current behavior.<br />

16 The Singleton pattern and the Double-Checked Locking<br />

pattern: How to ensure not more than one instance of a class<br />

is ever instantiated, even in a multithreaded environment.<br />

17 The Observer pattern: How to let one part of a system know<br />

when an event takes place in another.<br />

18 The Template Method pattern: What to do when you have<br />

different cases that use essentially the same procedure, but<br />

their steps must be implemented in slightly different ways.<br />

19 The Factory Method pattern: How to defer instantiation of<br />

particular objects to derived classes.<br />

20 The Analysis Matrix: How to track multiple variations that are<br />

present in your problem domain and map them into patterns.<br />

227

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!