Work towards #56: Add permalink to every pattern
This makes cleaner URLs thanks to jekyll
This commit is contained in:
parent
fbb12b53ba
commit
fdb9be1e76
abstract-factory
adapter
async-method-invocation
bridge
builder
business-delegate
callback
chain-of-responsibility
command
composite
dao
decorator
dependency-injection
double-checked-locking
double-dispatch
event-aggregator
execute-around
facade
factory-method
flux
flyweight
front-controller
half-sync-half-async
idioms
intercepting-filter
interpreter
introduction
iterator
lazy-loading
mediator
memento
model-view-controller
model-view-presenter
multiton
naked-objects
null-object
object-pool
observer
poison-pill
private-class-data
property
prototype
proxy
repository
resource-acquisition-is-initialization
servant
service-layer
service-locator
singleton
specification
state
step-builder
strategy
template-method
thread-pool
tolerant-reader
visitor
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Abstract Factory
|
title: Abstract Factory
|
||||||
folder: abstract-factory
|
folder: abstract-factory
|
||||||
|
permalink: /patterns/abstract-factory/
|
||||||
categories:
|
categories:
|
||||||
- pattern_cat
|
- pattern_cat
|
||||||
- creational
|
- creational
|
||||||
@ -22,4 +23,4 @@ objects without specifying their concrete classes.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [javax.xml.parsers.DocumentBuilderFactory](http://docs.oracle.com/javase/8/docs/api/javax/xml/parsers/DocumentBuilderFactory.html)
|
* [javax.xml.parsers.DocumentBuilderFactory](http://docs.oracle.com/javase/8/docs/api/javax/xml/parsers/DocumentBuilderFactory.html)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Adapter
|
title: Adapter
|
||||||
folder: adapter
|
folder: adapter
|
||||||
|
permalink: /patterns/adapter/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -20,4 +21,4 @@ incompatible interfaces.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [java.util.Arrays#asList()](http://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html#asList%28T...%29)
|
* [java.util.Arrays#asList()](http://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html#asList%28T...%29)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Async Method Invocation
|
title: Async Method Invocation
|
||||||
folder: async-method-invocation
|
folder: async-method-invocation
|
||||||
|
permalink: /patterns/async-method-invocation/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -23,4 +24,4 @@ callbacks or waiting until everything is done.
|
|||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [FutureTask](http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/FutureTask.html), [CompletableFuture](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html) and [ExecutorService](http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html) (Java)
|
* [FutureTask](http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/FutureTask.html), [CompletableFuture](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html) and [ExecutorService](http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html) (Java)
|
||||||
* [Task-based Asynchronous Pattern](https://msdn.microsoft.com/en-us/library/hh873175.aspx) (.NET)
|
* [Task-based Asynchronous Pattern](https://msdn.microsoft.com/en-us/library/hh873175.aspx) (.NET)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Bridge
|
title: Bridge
|
||||||
folder: bridge
|
folder: bridge
|
||||||
|
permalink: /patterns/bridge/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -18,4 +19,4 @@ vary independently.
|
|||||||
* both the abstractions and their implementations should be extensible by subclassing. In this case, the Bridge pattern lets you combine the different abstractions and implementations and extend them independently
|
* both the abstractions and their implementations should be extensible by subclassing. In this case, the Bridge pattern lets you combine the different abstractions and implementations and extend them independently
|
||||||
* changes in the implementation of an abstraction should have no impact on clients; that is, their code should not have to be recompiled.
|
* changes in the implementation of an abstraction should have no impact on clients; that is, their code should not have to be recompiled.
|
||||||
* you have a proliferation of classes. Such a class hierarchy indicates the need for splitting an object into two parts. Rumbaugh uses the term "nested generalizations" to refer to such class hierarchies
|
* you have a proliferation of classes. Such a class hierarchy indicates the need for splitting an object into two parts. Rumbaugh uses the term "nested generalizations" to refer to such class hierarchies
|
||||||
* you want to share an implementation among multiple objects (perhaps using reference counting), and this fact should be hidden from the client. A simple example is Coplien's String class, in which multiple objects can share the same string representation.
|
* you want to share an implementation among multiple objects (perhaps using reference counting), and this fact should be hidden from the client. A simple example is Coplien's String class, in which multiple objects can share the same string representation.
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Builder
|
title: Builder
|
||||||
folder: builder
|
folder: builder
|
||||||
|
permalink: /patterns/builder/
|
||||||
categories: creational
|
categories: creational
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -20,4 +21,4 @@ representations.
|
|||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [java.lang.StringBuilder](http://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html)
|
* [java.lang.StringBuilder](http://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html)
|
||||||
* [Apache Camel builders](https://github.com/apache/camel/tree/0e195428ee04531be27a0b659005e3aa8d159d23/camel-core/src/main/java/org/apache/camel/builder)
|
* [Apache Camel builders](https://github.com/apache/camel/tree/0e195428ee04531be27a0b659005e3aa8d159d23/camel-core/src/main/java/org/apache/camel/builder)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Business Delegate
|
title: Business Delegate
|
||||||
folder: business-delegate
|
folder: business-delegate
|
||||||
|
permalink: /patterns/business-delegate/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -17,4 +18,4 @@ and interact with the business objects that make up the application.
|
|||||||
|
|
||||||
* you want loose coupling between presentation and business tiers
|
* you want loose coupling between presentation and business tiers
|
||||||
* you want to orchestrate calls to multiple business services
|
* you want to orchestrate calls to multiple business services
|
||||||
* you want to encapsulate service lookups and service calls
|
* you want to encapsulate service lookups and service calls
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Callback
|
title: Callback
|
||||||
folder: callback
|
folder: callback
|
||||||
|
permalink: /patterns/callback/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -18,4 +19,4 @@ at some convenient time.
|
|||||||
|
|
||||||
**Real world examples:**
|
**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.
|
* [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.
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Chain of responsibility
|
title: Chain of responsibility
|
||||||
folder: chain-of-responsibility
|
folder: chain-of-responsibility
|
||||||
|
permalink: /patterns/chain-of-responsibility/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -21,4 +22,4 @@ objects and pass the request along the chain until an object handles it.
|
|||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [java.util.logging.Logger#log()](http://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html#log%28java.util.logging.Level,%20java.lang.String%29)
|
* [java.util.logging.Logger#log()](http://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html#log%28java.util.logging.Level,%20java.lang.String%29)
|
||||||
* [Apache Commons Chain](https://commons.apache.org/proper/commons-chain/index.html)
|
* [Apache Commons Chain](https://commons.apache.org/proper/commons-chain/index.html)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Command
|
title: Command
|
||||||
folder: command
|
folder: command
|
||||||
|
permalink: /patterns/command/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -28,4 +29,4 @@ support undoable operations.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [java.lang.Runnable](http://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html)
|
* [java.lang.Runnable](http://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Composite
|
title: Composite
|
||||||
folder: composite
|
folder: composite
|
||||||
|
permalink: /patterns/composite/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -20,4 +21,4 @@ of objects uniformly.
|
|||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [java.awt.Container](http://docs.oracle.com/javase/8/docs/api/java/awt/Container.html) and [java.awt.Component](http://docs.oracle.com/javase/8/docs/api/java/awt/Component.html)
|
* [java.awt.Container](http://docs.oracle.com/javase/8/docs/api/java/awt/Container.html) and [java.awt.Component](http://docs.oracle.com/javase/8/docs/api/java/awt/Component.html)
|
||||||
* [Apache Wicket](https://github.com/apache/wicket) component tree, see [Component](https://github.com/apache/wicket/blob/91e154702ab1ff3481ef6cbb04c6044814b7e130/wicket-core/src/main/java/org/apache/wicket/Component.java) and [MarkupContainer](https://github.com/apache/wicket/blob/b60ec64d0b50a611a9549809c9ab216f0ffa3ae3/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java)
|
* [Apache Wicket](https://github.com/apache/wicket) component tree, see [Component](https://github.com/apache/wicket/blob/91e154702ab1ff3481ef6cbb04c6044814b7e130/wicket-core/src/main/java/org/apache/wicket/Component.java) and [MarkupContainer](https://github.com/apache/wicket/blob/b60ec64d0b50a611a9549809c9ab216f0ffa3ae3/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Data Access Object
|
title: Data Access Object
|
||||||
folder: dao
|
folder: dao
|
||||||
|
permalink: /patterns/dao/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -14,4 +15,4 @@ other persistence mechanism.
|
|||||||
**Applicability:** Use the Data Access Object in any of the following situations
|
**Applicability:** Use the Data Access Object in any of the following situations
|
||||||
|
|
||||||
* when you want to consolidate how the data layer is accessed
|
* when you want to consolidate how the data layer is accessed
|
||||||
* when you want to avoid writing multiple data retrieval/persistence layers
|
* when you want to avoid writing multiple data retrieval/persistence layers
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Decorator
|
title: Decorator
|
||||||
folder: decorator
|
folder: decorator
|
||||||
|
permalink: /patterns/decorator/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -16,4 +17,4 @@ functionality.
|
|||||||
|
|
||||||
* to add responsibilities to individual objects dynamically and transparently, that is, without affecting other objects
|
* to add responsibilities to individual objects dynamically and transparently, that is, without affecting other objects
|
||||||
* for responsibilities that can be withdrawn
|
* for responsibilities that can be withdrawn
|
||||||
* when extension by subclassing is impractical. Sometimes a large number of independent extensions are possible and would produce an explosion of subclasses to support every combination. Or a class definition may be hidden or otherwise unavailable for subclassing
|
* when extension by subclassing is impractical. Sometimes a large number of independent extensions are possible and would produce an explosion of subclasses to support every combination. Or a class definition may be hidden or otherwise unavailable for subclassing
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Dependency Injection
|
title: Dependency Injection
|
||||||
folder: dependency-injection
|
folder: dependency-injection
|
||||||
|
permalink: /patterns/dependency-injection/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -18,4 +19,4 @@ inversion of control and single responsibility principles.
|
|||||||
**Applicability:** Use the Dependency Injection pattern when
|
**Applicability:** Use the Dependency Injection pattern when
|
||||||
|
|
||||||
* when you need to remove knowledge of concrete implementation from object
|
* when you need to remove knowledge of concrete implementation from object
|
||||||
* to enable unit testing of classes in isolation using mock objects or stubs
|
* to enable unit testing of classes in isolation using mock objects or stubs
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Double Checked Locking
|
title: Double Checked Locking
|
||||||
folder: double-checked-locking
|
folder: double-checked-locking
|
||||||
|
permalink: /patterns/double-checked-locking/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -16,4 +17,4 @@ actual locking logic proceed.
|
|||||||
**Applicability:** Use the Double Checked Locking pattern when
|
**Applicability:** Use the Double Checked Locking pattern when
|
||||||
|
|
||||||
* 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.
|
* 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.
|
||||||
* 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.
|
* 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.
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Double Dispatch
|
title: Double Dispatch
|
||||||
folder: double-dispatch
|
folder: double-dispatch
|
||||||
|
permalink: /patterns/double-dispatch/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -17,4 +18,4 @@ behavior based on receiver and parameter types.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [ObjectOutputStream](https://docs.oracle.com/javase/8/docs/api/java/io/ObjectOutputStream.html)
|
* [ObjectOutputStream](https://docs.oracle.com/javase/8/docs/api/java/io/ObjectOutputStream.html)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Event Aggregator
|
title: Event Aggregator
|
||||||
folder: event-aggregator
|
folder: event-aggregator
|
||||||
|
permalink: /patterns/event-aggregator/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -21,4 +22,4 @@ allowing clients to register with just the aggregator.
|
|||||||
potential event sources. Rather than have the observer deal with registering
|
potential event sources. Rather than have the observer deal with registering
|
||||||
with them all, you can centralize the registration logic to the Event
|
with them all, you can centralize the registration logic to the Event
|
||||||
Aggregator. As well as simplifying registration, a Event Aggregator also
|
Aggregator. As well as simplifying registration, a Event Aggregator also
|
||||||
simplifies the memory management issues in using observers.
|
simplifies the memory management issues in using observers.
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Execute Around
|
title: Execute Around
|
||||||
folder: execute-around
|
folder: execute-around
|
||||||
|
permalink: /patterns/execute-around/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -15,4 +16,4 @@ only what to do with the resource.
|
|||||||
|
|
||||||
**Applicability:** Use the Execute Around idiom when
|
**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.
|
* you use an API that requires methods to be called in pairs such as open/close or allocate/deallocate.
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Facade
|
title: Facade
|
||||||
folder: facade
|
folder: facade
|
||||||
|
permalink: /patterns/facade/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -15,4 +16,4 @@ Facade defines a higher-level interface that makes the subsystem easier to use.
|
|||||||
|
|
||||||
* you want to provide a simple interface to a complex subsystem. Subsystems often get more complex as they evolve. Most patterns, when applied, result in more and smaller classes. This makes the subsystem more reusable and easier to customize, but it also becomes harder to use for clients that don't need to customize it. A facade can provide a simple default view of the subsystem that is good enough for most clients. Only clients needing more customizability will need to look beyond the facade.
|
* you want to provide a simple interface to a complex subsystem. Subsystems often get more complex as they evolve. Most patterns, when applied, result in more and smaller classes. This makes the subsystem more reusable and easier to customize, but it also becomes harder to use for clients that don't need to customize it. A facade can provide a simple default view of the subsystem that is good enough for most clients. Only clients needing more customizability will need to look beyond the facade.
|
||||||
* there are many dependencies between clients and the implementation classes of an abstraction. Introduce a facade to decouple the subsystem from clients and other subsystems, thereby promoting subsystem independence and portability.
|
* there are many dependencies between clients and the implementation classes of an abstraction. Introduce a facade to decouple the subsystem from clients and other subsystems, thereby promoting subsystem independence and portability.
|
||||||
* you want to layer your subsystems. Use a facade to define an entry point to each subsystem level. If subsystems are dependent, the you can simplify the dependencies between them by making them communicate with each other solely through their facades
|
* you want to layer your subsystems. Use a facade to define an entry point to each subsystem level. If subsystems are dependent, the you can simplify the dependencies between them by making them communicate with each other solely through their facades
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Factory Method
|
title: Factory Method
|
||||||
folder: factory-method
|
folder: factory-method
|
||||||
|
permalink: /patterns/factory-method/
|
||||||
categories: creational
|
categories: creational
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -16,4 +17,4 @@ instantiation to subclasses.
|
|||||||
|
|
||||||
* a class can't anticipate the class of objects it must create
|
* a class can't anticipate the class of objects it must create
|
||||||
* a class wants its subclasses to specify the objects it creates
|
* a class wants its subclasses to specify the objects it creates
|
||||||
* classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass is the delegate
|
* classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass is the delegate
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Flux
|
title: Flux
|
||||||
folder: flux
|
folder: flux
|
||||||
|
permalink: /patterns/flux/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -15,4 +16,4 @@ logic, which updates all of the views that are affected.
|
|||||||
|
|
||||||
**Applicability:** Use the Flux pattern when
|
**Applicability:** Use the Flux pattern when
|
||||||
|
|
||||||
* you want to focus on creating explicit and understandable update paths for your application's data, which makes tracing changes during development simpler and makes bugs easier to track down and fix.
|
* you want to focus on creating explicit and understandable update paths for your application's data, which makes tracing changes during development simpler and makes bugs easier to track down and fix.
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Flyweight
|
title: Flyweight
|
||||||
folder: flyweight
|
folder: flyweight
|
||||||
|
permalink: /patterns/flyweight/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -22,4 +23,4 @@ true
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [java.lang.Integer#valueOf(int)](http://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html#valueOf%28int%29)
|
* [java.lang.Integer#valueOf(int)](http://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html#valueOf%28int%29)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Front Controller
|
title: Front Controller
|
||||||
folder: front-controller
|
folder: front-controller
|
||||||
|
permalink: /patterns/front-controller/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -20,4 +21,4 @@ internationalization, routing and logging in a single place.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [Apache Struts](https://struts.apache.org/)
|
* [Apache Struts](https://struts.apache.org/)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Half-Sync/Half-Async
|
title: Half-Sync/Half-Async
|
||||||
folder: half-sync-half-async
|
folder: half-sync-half-async
|
||||||
|
permalink: /patterns/half-sync-half-async/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -24,4 +25,4 @@ degrading execution efficiency.
|
|||||||
|
|
||||||
* [BSD Unix networking subsystem](http://www.cs.wustl.edu/~schmidt/PDF/PLoP-95.pdf)
|
* [BSD Unix networking subsystem](http://www.cs.wustl.edu/~schmidt/PDF/PLoP-95.pdf)
|
||||||
* [Real Time CORBA](http://www.omg.org/news/meetings/workshops/presentations/realtime2001/4-3_Pyarali_thread-pool.pdf)
|
* [Real Time CORBA](http://www.omg.org/news/meetings/workshops/presentations/realtime2001/4-3_Pyarali_thread-pool.pdf)
|
||||||
* [Android AsyncTask framework](http://developer.android.com/reference/android/os/AsyncTask.html)
|
* [Android AsyncTask framework](http://developer.android.com/reference/android/os/AsyncTask.html)
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
---
|
|
||||||
layout: pattern
|
|
||||||
title: Idioms
|
|
||||||
folder: idioms
|
|
||||||
categories: pattern_cat
|
|
||||||
tags: pattern_tag
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
A programming idiom is a means of expressing a recurring construct in one or
|
|
||||||
more programming languages. Generally speaking, a programming idiom is an
|
|
||||||
expression of a simple task, algorithm, or data structure that is not a built-in
|
|
||||||
feature in the programming language being used, or, conversely, the use of an
|
|
||||||
unusual or notable feature that is built into a programming language. What
|
|
||||||
distinguishes idioms from patterns is generally the size, the idioms tend to be
|
|
||||||
something small while the patterns are larger.
|
|
||||||
|
|
||||||
* [Execute Around](#execute-around)
|
|
||||||
* [Poison Pill](#poison-pill)
|
|
||||||
* [Callback](#callback)
|
|
||||||
* [Lazy Loading](#lazy-loading)
|
|
||||||
* [Double Dispatch](#double-dispatch)
|
|
||||||
* [Resource Acquisition Is Initialization](#resource-acquisition-is-initialization)
|
|
||||||
* [Private Class Data](#private-class-data)
|
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Intercepting Filter
|
title: Intercepting Filter
|
||||||
folder: intercepting-filter
|
folder: intercepting-filter
|
||||||
|
permalink: /patterns/intercepting-filter/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -15,4 +16,4 @@ post-processing to requests from a client to a target
|
|||||||
|
|
||||||
* a system uses pre-processing or post-processing requests
|
* a system uses pre-processing or post-processing requests
|
||||||
* a system should do the authentication/ authorization/ logging or tracking of request and then pass the requests to corresponding handlers
|
* a system should do the authentication/ authorization/ logging or tracking of request and then pass the requests to corresponding handlers
|
||||||
* you want a modular approach to configuring pre-processing and post-processing schemes
|
* you want a modular approach to configuring pre-processing and post-processing schemes
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Interpreter
|
title: Interpreter
|
||||||
folder: interpreter
|
folder: interpreter
|
||||||
|
permalink: /patterns/interpreter/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -16,4 +17,4 @@ language.
|
|||||||
interpret, and you can represent statements in the language as abstract syntax
|
interpret, and you can represent statements in the language as abstract syntax
|
||||||
trees. The Interpreter pattern works best when
|
trees. The Interpreter pattern works best when
|
||||||
* the grammar is simple. For complex grammars, the class hierarchy for the grammar becomes large and unmanageable. Tools such as parser generators are a better alternative in such cases. They can interpret expressions without building abstract syntax trees, which can save space and possibly time
|
* the grammar is simple. For complex grammars, the class hierarchy for the grammar becomes large and unmanageable. Tools such as parser generators are a better alternative in such cases. They can interpret expressions without building abstract syntax trees, which can save space and possibly time
|
||||||
* efficiency is not a critical concern. The most efficient interpreters are usually not implemented by interpreting parse trees directly but by first translating them into another form. For example, regular expressions are often transformed into state machines. But even then, the translator can be implemented by the Interpreter pattern, so the pattern is still applicable
|
* efficiency is not a critical concern. The most efficient interpreters are usually not implemented by interpreting parse trees directly but by first translating them into another form. For example, regular expressions are often transformed into state machines. But even then, the translator can be implemented by the Interpreter pattern, so the pattern is still applicable
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Introduction
|
title: Introduction
|
||||||
folder: introduction
|
folder: introduction
|
||||||
|
permalink: /patterns/introduction/
|
||||||
|
permalink: /patterns/introduction/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -15,4 +17,4 @@ development paradigms.
|
|||||||
|
|
||||||
Reusing design patterns helps to prevent subtle issues that can cause major
|
Reusing design patterns helps to prevent subtle issues that can cause major
|
||||||
problems, and it also improves code readability for coders and architects who
|
problems, and it also improves code readability for coders and architects who
|
||||||
are familiar with the patterns.
|
are familiar with the patterns.
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Iterator
|
title: Iterator
|
||||||
folder: iterator
|
folder: iterator
|
||||||
|
permalink: /patterns/iterator/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -19,4 +20,4 @@ sequentially without exposing its underlying representation.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [java.util.Iterator](http://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html)
|
* [java.util.Iterator](http://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Lazy Loading
|
title: Lazy Loading
|
||||||
folder: lazy-loading
|
folder: lazy-loading
|
||||||
|
permalink: /patterns/lazy-loading/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -19,4 +20,4 @@ appropriately used.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* JPA annotations @OneToOne, @OneToMany, @ManyToOne, @ManyToMany and fetch = FetchType.LAZY
|
* JPA annotations @OneToOne, @OneToMany, @ManyToOne, @ManyToMany and fetch = FetchType.LAZY
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Mediator
|
title: Mediator
|
||||||
folder: mediator
|
folder: mediator
|
||||||
|
permalink: /patterns/mediator/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -16,4 +17,4 @@ other explicitly, and it lets you vary their interaction independently.
|
|||||||
|
|
||||||
* a set of objects communicate in well-defined but complex ways. The resulting interdependencies are unstructured and difficult to understand
|
* a set of objects communicate in well-defined but complex ways. The resulting interdependencies are unstructured and difficult to understand
|
||||||
* reusing an object is difficult because it refers to and communicates with many other objects
|
* reusing an object is difficult because it refers to and communicates with many other objects
|
||||||
* a behavior that's distributed between several classes should be customizable without a lot of subclassing
|
* a behavior that's distributed between several classes should be customizable without a lot of subclassing
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Memento
|
title: Memento
|
||||||
folder: memento
|
folder: memento
|
||||||
|
permalink: /patterns/memento/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -18,4 +19,4 @@ object's internal state so that the object can be restored to this state later.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [java.util.Date](http://docs.oracle.com/javase/8/docs/api/java/util/Date.html)
|
* [java.util.Date](http://docs.oracle.com/javase/8/docs/api/java/util/Date.html)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Model-View-Controller
|
title: Model-View-Controller
|
||||||
folder: model-view-controller
|
folder: model-view-controller
|
||||||
|
permalink: /patterns/model-view-controller/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -15,4 +16,4 @@ display.
|
|||||||
|
|
||||||
**Applicability:** Use the Model-View-Controller pattern when
|
**Applicability:** Use the Model-View-Controller pattern when
|
||||||
|
|
||||||
* you want to clearly separate the domain data from its user interface representation
|
* you want to clearly separate the domain data from its user interface representation
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Model-View-Presenter
|
title: Model-View-Presenter
|
||||||
folder: model-view-presenter
|
folder: model-view-presenter
|
||||||
|
permalink: /patterns/model-view-presenter/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -14,4 +15,4 @@ developers to build and test user interfaces.
|
|||||||
**Applicability:** Use the Model-View-Presenter in any of the following
|
**Applicability:** Use the Model-View-Presenter in any of the following
|
||||||
situations
|
situations
|
||||||
* when you want to improve the "Separation of Concerns" principle in presentation logic
|
* when you want to improve the "Separation of Concerns" principle in presentation logic
|
||||||
* when a user interface development and testing is necessary.
|
* when a user interface development and testing is necessary.
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Multiton
|
title: Multiton
|
||||||
folder: multiton
|
folder: multiton
|
||||||
|
permalink: /patterns/multiton/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -13,4 +14,4 @@ global point of access to them.
|
|||||||
|
|
||||||
**Applicability:** Use the Multiton pattern when
|
**Applicability:** Use the Multiton pattern when
|
||||||
|
|
||||||
* there must be specific number of instances of a class, and they must be accessible to clients from a well-known access point
|
* there must be specific number of instances of a class, and they must be accessible to clients from a well-known access point
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Naked Objects
|
title: Naked Objects
|
||||||
folder: naked-objects
|
folder: naked-objects
|
||||||
|
permalink: /patterns/naked-objects/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -20,4 +21,4 @@ everything else is autogenerated by the framework.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [Apache Isis](https://isis.apache.org/)
|
* [Apache Isis](https://isis.apache.org/)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Null Object
|
title: Null Object
|
||||||
folder: null-object
|
folder: null-object
|
||||||
|
permalink: /patterns/null-object/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -19,4 +20,4 @@ Object is very predictable and has no side effects: it does nothing.
|
|||||||
|
|
||||||
**Applicability:** Use the Null Object pattern when
|
**Applicability:** Use the Null Object pattern when
|
||||||
|
|
||||||
* you want to avoid explicit null checks and keep the algorithm elegant and easy to read.
|
* you want to avoid explicit null checks and keep the algorithm elegant and easy to read.
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Object Pool
|
title: Object Pool
|
||||||
folder: object-pool
|
folder: object-pool
|
||||||
|
permalink: /patterns/object-pool/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -16,4 +17,4 @@ are in use and which are available.
|
|||||||
**Applicability:** Use the Object Pool pattern when
|
**Applicability:** Use the Object Pool pattern when
|
||||||
|
|
||||||
* the objects are expensive to create (allocation cost)
|
* the objects are expensive to create (allocation cost)
|
||||||
* you need a large number of short-lived objects (memory fragmentation)
|
* you need a large number of short-lived objects (memory fragmentation)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Observer
|
title: Observer
|
||||||
folder: observer
|
folder: observer
|
||||||
|
permalink: /patterns/observer/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -24,4 +25,4 @@ automatically.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [java.util.Observer](http://docs.oracle.com/javase/8/docs/api/java/util/Observer.html)
|
* [java.util.Observer](http://docs.oracle.com/javase/8/docs/api/java/util/Observer.html)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Poison Pill
|
title: Poison Pill
|
||||||
folder: poison-pill
|
folder: poison-pill
|
||||||
|
permalink: /patterns/poison-pill/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -17,4 +18,4 @@ graceful shutdown for separate distributed consumption process.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [akka.actor.PoisonPill](http://doc.akka.io/docs/akka/2.1.4/java/untyped-actors.html)
|
* [akka.actor.PoisonPill](http://doc.akka.io/docs/akka/2.1.4/java/untyped-actors.html)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Private Class Data
|
title: Private Class Data
|
||||||
folder: private-class-data
|
folder: private-class-data
|
||||||
|
permalink: /patterns/private-class-data/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -14,4 +15,4 @@ attributes by encapsulating them in single Data object.
|
|||||||
|
|
||||||
**Applicability:** Use the Private Class Data pattern when
|
**Applicability:** Use the Private Class Data pattern when
|
||||||
|
|
||||||
* you want to prevent write access to class data members
|
* you want to prevent write access to class data members
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Property
|
title: Property
|
||||||
folder: property
|
folder: property
|
||||||
|
permalink: /patterns/property/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -17,4 +18,4 @@ objects as parents.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain) prototype inheritance
|
* [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain) prototype inheritance
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Prototype
|
title: Prototype
|
||||||
folder: prototype
|
folder: prototype
|
||||||
|
permalink: /patterns/prototype/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -19,4 +20,4 @@ instance, and create new objects by copying this prototype.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [java.lang.Object#clone()](http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone%28%29)
|
* [java.lang.Object#clone()](http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone%28%29)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Proxy
|
title: Proxy
|
||||||
folder: proxy
|
folder: proxy
|
||||||
|
permalink: /patterns/proxy/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -30,4 +31,4 @@ are several common situations in which the Proxy pattern is applicable
|
|||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [java.lang.reflect.Proxy](http://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Proxy.html)
|
* [java.lang.reflect.Proxy](http://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Proxy.html)
|
||||||
* [Apache Commons Proxy](https://commons.apache.org/proper/commons-proxy/)
|
* [Apache Commons Proxy](https://commons.apache.org/proper/commons-proxy/)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Repository
|
title: Repository
|
||||||
folder: repository
|
folder: repository
|
||||||
|
permalink: /patterns/repository/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -23,4 +24,4 @@ querying is utilized.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [Spring Data](http://projects.spring.io/spring-data/)
|
* [Spring Data](http://projects.spring.io/spring-data/)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Resource Acquisition Is Initialization
|
title: Resource Acquisition Is Initialization
|
||||||
folder: resource-acquisition-is-initialization
|
folder: resource-acquisition-is-initialization
|
||||||
|
permalink: /patterns/resource-acquisition-is-initialization/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -12,4 +13,4 @@ tags: pattern_tag
|
|||||||
|
|
||||||
**Applicability:** Use the Resource Acquisition Is Initialization pattern when
|
**Applicability:** Use the Resource Acquisition Is Initialization pattern when
|
||||||
|
|
||||||
* you have resources that must be closed in every condition
|
* you have resources that must be closed in every condition
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Servant
|
title: Servant
|
||||||
folder: servant
|
folder: servant
|
||||||
|
permalink: /patterns/servant/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -14,4 +15,4 @@ this behavior in the common parent class - it is defined once in the Servant.
|
|||||||
|
|
||||||
**Applicability:** Use the Servant pattern when
|
**Applicability:** Use the Servant pattern when
|
||||||
|
|
||||||
* when we want some objects to perform a common action and don't want to define this action as a method in every class.
|
* when we want some objects to perform a common action and don't want to define this action as a method in every class.
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Service Layer
|
title: Service Layer
|
||||||
folder: service-layer
|
folder: service-layer
|
||||||
|
permalink: /patterns/service-layer/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -18,4 +19,4 @@ its business logic. The Service Layer fulfills this role.
|
|||||||
**Applicability:** Use the Service Layer pattern when
|
**Applicability:** Use the Service Layer pattern when
|
||||||
|
|
||||||
* you want to encapsulate domain logic under API
|
* you want to encapsulate domain logic under API
|
||||||
* you need to implement multiple interfaces with common logic and data
|
* you need to implement multiple interfaces with common logic and data
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Service Locator
|
title: Service Locator
|
||||||
folder: service-locator
|
folder: service-locator
|
||||||
|
permalink: /patterns/service-locator/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -24,4 +25,4 @@ improves the performance of application to great extent.
|
|||||||
|
|
||||||
* when network hits are expensive and time consuming
|
* when network hits are expensive and time consuming
|
||||||
* lookups of services are done quite frequently
|
* lookups of services are done quite frequently
|
||||||
* large number of services are being used
|
* large number of services are being used
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Singleton
|
title: Singleton
|
||||||
folder: singleton
|
folder: singleton
|
||||||
|
permalink: /patterns/singleton/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -24,4 +25,4 @@ access to it.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [java.lang.Runtime#getRuntime()](http://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#getRuntime%28%29)
|
* [java.lang.Runtime#getRuntime()](http://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#getRuntime%28%29)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Specification
|
title: Specification
|
||||||
folder: specification
|
folder: specification
|
||||||
|
permalink: /patterns/specification/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -16,4 +17,4 @@ order
|
|||||||
**Applicability:** Use the Specification pattern when
|
**Applicability:** Use the Specification pattern when
|
||||||
|
|
||||||
* you need to select a subset of objects based on some criteria, and to refresh the selection at various times
|
* you need to select a subset of objects based on some criteria, and to refresh the selection at various times
|
||||||
* you need to check that only suitable objects are used for a certain role (validation)
|
* you need to check that only suitable objects are used for a certain role (validation)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: State
|
title: State
|
||||||
folder: state
|
folder: state
|
||||||
|
permalink: /patterns/state/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -14,4 +15,4 @@ changes. The object will appear to change its class.
|
|||||||
**Applicability:** Use the State pattern in either of the following cases
|
**Applicability:** Use the State pattern in either of the following cases
|
||||||
|
|
||||||
* an object's behavior depends on its state, and it must change its behavior at run-time depending on that state
|
* an object's behavior depends on its state, and it must change its behavior at run-time depending on that state
|
||||||
* operations have large, multipart conditional statements that depend on the object's state. This state is usually represented by one or more enumerated constants. Often, several operations will contain this same conditional structure. The State pattern puts each branch of the conditional in a separate class. This lets you treat the object's state as an object in its own right that can vary independently from other objects.
|
* operations have large, multipart conditional statements that depend on the object's state. This state is usually represented by one or more enumerated constants. Often, several operations will contain this same conditional structure. The State pattern puts each branch of the conditional in a separate class. This lets you treat the object's state as an object in its own right that can vary independently from other objects.
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Step Builder
|
title: Step Builder
|
||||||
folder: step-builder
|
folder: step-builder
|
||||||
|
permalink: /patterns/step-builder/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -11,4 +12,4 @@ The user experience will be much more improved by the fact that he will only see
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
**Applicability:** Use the Step Builder pattern when the algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled the construction process must allow different representations for the object that's constructed when in the process of constructing the order is important.
|
**Applicability:** Use the Step Builder pattern when the algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled the construction process must allow different representations for the object that's constructed when in the process of constructing the order is important.
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Strategy
|
title: Strategy
|
||||||
folder: strategy
|
folder: strategy
|
||||||
|
permalink: /patterns/strategy/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -17,4 +18,4 @@ that use it.
|
|||||||
* many related classes differ only in their behavior. Strategies provide a way to configure a class either one of many behaviors
|
* many related classes differ only in their behavior. Strategies provide a way to configure a class either one of many behaviors
|
||||||
* you need different variants of an algorithm. for example, you might define algorithms reflecting different space/time trade-offs. Strategies can be used when these variants are implemented as a class hierarchy of algorithms
|
* you need different variants of an algorithm. for example, you might define algorithms reflecting different space/time trade-offs. Strategies can be used when these variants are implemented as a class hierarchy of algorithms
|
||||||
* an algorithm uses data that clients shouldn't know about. Use the Strategy pattern to avoid exposing complex, algorithm-specific data structures
|
* an algorithm uses data that clients shouldn't know about. Use the Strategy pattern to avoid exposing complex, algorithm-specific data structures
|
||||||
* a class defines many behaviors, and these appear as multiple conditional statements in its operations. Instead of many conditionals, move related conditional branches into their own Strategy class
|
* a class defines many behaviors, and these appear as multiple conditional statements in its operations. Instead of many conditionals, move related conditional branches into their own Strategy class
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Template method
|
title: Template method
|
||||||
folder: template-method
|
folder: template-method
|
||||||
|
permalink: /patterns/template-method/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -16,4 +17,4 @@ an algorithm without changing the algorithm's structure.
|
|||||||
|
|
||||||
* to implement the invariant parts of an algorithm once and leave it up to subclasses to implement the behavior that can vary
|
* to implement the invariant parts of an algorithm once and leave it up to subclasses to implement the behavior that can vary
|
||||||
* when common behavior among subclasses should be factored and localized in a common class to avoid code duplication. This is good example of "refactoring to generalize" as described by Opdyke and Johnson. You first identify the differences in the existing code and then separate the differences into new operations. Finally, you replace the differing code with a template method that calls one of these new operations
|
* when common behavior among subclasses should be factored and localized in a common class to avoid code duplication. This is good example of "refactoring to generalize" as described by Opdyke and Johnson. You first identify the differences in the existing code and then separate the differences into new operations. Finally, you replace the differing code with a template method that calls one of these new operations
|
||||||
* to control subclasses extensions. You can define a template method that calls "hook" operations at specific points, thereby permitting extensions only at those points
|
* to control subclasses extensions. You can define a template method that calls "hook" operations at specific points, thereby permitting extensions only at those points
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Thread Pool
|
title: Thread Pool
|
||||||
folder: thread-pool
|
folder: thread-pool
|
||||||
|
permalink: /patterns/thread-pool/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -16,4 +17,4 @@ and eliminating the latency of creating new threads.
|
|||||||
|
|
||||||
**Applicability:** Use the Thread Pool pattern when
|
**Applicability:** Use the Thread Pool pattern when
|
||||||
|
|
||||||
* you have a large number of short-lived tasks to be executed in parallel
|
* you have a large number of short-lived tasks to be executed in parallel
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Tolerant Reader
|
title: Tolerant Reader
|
||||||
folder: tolerant-reader
|
folder: tolerant-reader
|
||||||
|
permalink: /patterns/tolerant-reader/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -15,4 +16,4 @@ changes, the readers must not break.
|
|||||||
|
|
||||||
**Applicability:** Use the Tolerant Reader pattern when
|
**Applicability:** Use the Tolerant Reader pattern when
|
||||||
|
|
||||||
* the communication schema can evolve and change and yet the receiving side should not break
|
* the communication schema can evolve and change and yet the receiving side should not break
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
layout: pattern
|
layout: pattern
|
||||||
title: Visitor
|
title: Visitor
|
||||||
folder: visitor
|
folder: visitor
|
||||||
|
permalink: /patterns/visitor/
|
||||||
categories: pattern_cat
|
categories: pattern_cat
|
||||||
tags: pattern_tag
|
tags: pattern_tag
|
||||||
---
|
---
|
||||||
@ -20,4 +21,4 @@ of the elements on which it operates.
|
|||||||
|
|
||||||
**Real world examples:**
|
**Real world examples:**
|
||||||
|
|
||||||
* [Apache Wicket](https://github.com/apache/wicket) component tree, see [MarkupContainer](https://github.com/apache/wicket/blob/b60ec64d0b50a611a9549809c9ab216f0ffa3ae3/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java)
|
* [Apache Wicket](https://github.com/apache/wicket) component tree, see [MarkupContainer](https://github.com/apache/wicket/blob/b60ec64d0b50a611a9549809c9ab216f0ffa3ae3/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user