From c26ba609b221490eb67297011b69f91265f90a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yusuf=20Ayta=C5=9F?= Date: Sun, 7 Sep 2014 21:04:01 +0100 Subject: [PATCH] Added Double Checked Locking to documentation. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index d15edc87a..c2c47f13f 100644 --- a/README.md +++ b/README.md @@ -239,6 +239,12 @@ * many distinct and unrelated operations need to be performed on objects in an object structure, and you want to avoid "polluting" their classes with these operations. Visitor lets you keep related operations together by defining them in one class. When the object structure is shared by many applications, use Visitor to put operations in just those applications that need them * the classes defining the object structure rarely change, but you often want to define new operations over the structure. Changing the object structure classes requires redefining the interface to all visitors, which is potentially costly. If the object structure classes change often, then it's probably better to define the operations in those classes +![alt text](https://github.com/iluwatar/java-design-patterns/blob/master/double-checked-locking/etc/double_checked_locking.jpg "Double Checked Locking") + +**Applicability:** Use the Visitor pattern when +* an object structure contains many classes of objects with differing interfaces, and you want to perform operations on these objects that depend on their concrete classes +* many distinct and unrelated operations need to be performed on objects in an object structure, and you want to avoid "polluting" their classes with these operations. Visitor lets you keep related operations together by defining them in one class. When the object structure is shared by many applications, use Visitor to put operations in just those applications that need them +* the classes defining the object structure rarely change, but you often want to define new operations over the structure. Changing the object structure classes requires redefining the interface to all visitors, which is potentially costly. If the object structure classes change often, then it's probably better to define the operations in those classes # Frequently asked questions