Skip to content

Commit acfdb41

Browse files
committed
Update README.md
1 parent ff5d58e commit acfdb41

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,15 @@
285285
* there is a concurrent access in object creation, e.g. singleton, where you want to create single instance of the same class and checking if it's null or not maybe not be enough when there are two or more threads that checks if instance is null or not.
286286
* there is a concurrent access on a method where method's behaviour changes according to the some constraints and these constraint change within this method.
287287

288+
##Servant
289+
**Intent:** Servant is used for providing some behavior to a group of classes. Instead of defining that behavior in each class - or when we cannot factor out this behavior in the common parent class - it is defined once in the Servant.
290+
291+
![alt text](https://github.com/iluwatar/java-design-patterns/blob/master/servant/etc/servant.jpg "Servant")
292+
293+
**Applicability:** Use the Servant pattern when
294+
* When we want some objects to perform a common action and don't want to define this action as a method in every class.
295+
296+
288297
# Frequently asked questions
289298

290299
**Q: What is the difference between State and Strategy patterns?**

0 commit comments

Comments
 (0)