Merge branch 'vehpsr-master'
This commit is contained in:
commit
eddf2e630f
@ -422,6 +422,9 @@ Behavioral patterns are concerned with algorithms and the assignment of responsi
|
||||
**Applicability:** Use the Callback pattern when
|
||||
* When some arbitrary synchronous or asynchronous action must be performed after execution of some defined activity.
|
||||
|
||||
**Real world examples:**
|
||||
* [CyclicBarrier] (http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CyclicBarrier.html#CyclicBarrier%28int,%20java.lang.Runnable%29) constructor can accept callback that will be triggered every time when barrier is tripped.
|
||||
|
||||
## <a name="execute-around">Execute Around</a> [↑](#list-of-design-patterns)
|
||||
**Intent:** Execute Around idiom frees the user from certain actions that should always be executed before and after the business method. A good example of this is resource allocation and deallocation leaving the user to specify only what to do with the resource.
|
||||
|
||||
@ -430,7 +433,6 @@ Behavioral patterns are concerned with algorithms and the assignment of responsi
|
||||
**Applicability:** Use the Execute Around idiom when
|
||||
* You use an API that requires methods to be called in pairs such as open/close or allocate/deallocate.
|
||||
|
||||
|
||||
# Frequently asked questions
|
||||
|
||||
**<a id="Q1">Q: What is the difference between State and Strategy patterns?</a>**
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
* Callback pattern is more native for dynamic languages where function are first-class citizen.
|
||||
* Callback pattern is more native for functional languages where function is treated as first-class citizen.
|
||||
* Prior to Java8 can be simulated using simple (alike command) interfaces.
|
||||
*/
|
||||
public class App {
|
||||
|
Loading…
x
Reference in New Issue
Block a user