提交 fdb9be1e 编写于 作者: M Markus

Work towards #56: Add permalink to every pattern

This makes cleaner URLs thanks to jekyll
上级 fbb12b53
......@@ -2,6 +2,7 @@
layout: pattern
title: Abstract Factory
folder: abstract-factory
permalink: /patterns/abstract-factory/
categories:
- pattern_cat
- creational
......@@ -22,4 +23,4 @@ objects without specifying their concrete classes.
**Real world examples:**
* [javax.xml.parsers.DocumentBuilderFactory](http://docs.oracle.com/javase/8/docs/api/javax/xml/parsers/DocumentBuilderFactory.html)
\ No newline at end of file
* [javax.xml.parsers.DocumentBuilderFactory](http://docs.oracle.com/javase/8/docs/api/javax/xml/parsers/DocumentBuilderFactory.html)
......@@ -2,6 +2,7 @@
layout: pattern
title: Adapter
folder: adapter
permalink: /patterns/adapter/
categories: pattern_cat
tags: pattern_tag
---
......@@ -20,4 +21,4 @@ incompatible interfaces.
**Real world examples:**
* [java.util.Arrays#asList()](http://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html#asList%28T...%29)
\ No newline at end of file
* [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
title: Async Method Invocation
folder: async-method-invocation
permalink: /patterns/async-method-invocation/
categories: pattern_cat
tags: pattern_tag
---
......@@ -23,4 +24,4 @@ callbacks or waiting until everything is done.
**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)
* [Task-based Asynchronous Pattern](https://msdn.microsoft.com/en-us/library/hh873175.aspx) (.NET)
\ No newline at end of file
* [Task-based Asynchronous Pattern](https://msdn.microsoft.com/en-us/library/hh873175.aspx) (.NET)
......@@ -2,6 +2,7 @@
layout: pattern
title: Bridge
folder: bridge
permalink: /patterns/bridge/
categories: pattern_cat
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
* 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 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.
\ No newline at end of file
* 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
title: Builder
folder: builder
permalink: /patterns/builder/
categories: creational
tags: pattern_tag
---
......@@ -20,4 +21,4 @@ representations.
**Real world examples:**
* [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)
\ No newline at end of file
* [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
title: Business Delegate
folder: business-delegate
permalink: /patterns/business-delegate/
categories: pattern_cat
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 to orchestrate calls to multiple business services
* you want to encapsulate service lookups and service calls
\ No newline at end of file
* you want to encapsulate service lookups and service calls
......@@ -2,6 +2,7 @@
layout: pattern
title: Callback
folder: callback
permalink: /patterns/callback/
categories: pattern_cat
tags: pattern_tag
---
......@@ -18,4 +19,4 @@ at some convenient time.
**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.
\ No newline at end of file
* [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
title: Chain of responsibility
folder: chain-of-responsibility
permalink: /patterns/chain-of-responsibility/
categories: pattern_cat
tags: pattern_tag
---
......@@ -21,4 +22,4 @@ objects and pass the request along the chain until an object handles it.
**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)
* [Apache Commons Chain](https://commons.apache.org/proper/commons-chain/index.html)
\ No newline at end of file
* [Apache Commons Chain](https://commons.apache.org/proper/commons-chain/index.html)
......@@ -2,6 +2,7 @@
layout: pattern
title: Command
folder: command
permalink: /patterns/command/
categories: pattern_cat
tags: pattern_tag
---
......@@ -28,4 +29,4 @@ support undoable operations.
**Real world examples:**
* [java.lang.Runnable](http://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html)
\ No newline at end of file
* [java.lang.Runnable](http://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html)
......@@ -2,6 +2,7 @@
layout: pattern
title: Composite
folder: composite
permalink: /patterns/composite/
categories: pattern_cat
tags: pattern_tag
---
......@@ -20,4 +21,4 @@ of objects uniformly.
**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)
* [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)
\ No newline at end of file
* [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
title: Data Access Object
folder: dao
permalink: /patterns/dao/
categories: pattern_cat
tags: pattern_tag
---
......@@ -14,4 +15,4 @@ other persistence mechanism.
**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 avoid writing multiple data retrieval/persistence layers
\ No newline at end of file
* when you want to avoid writing multiple data retrieval/persistence layers
......@@ -2,6 +2,7 @@
layout: pattern
title: Decorator
folder: decorator
permalink: /patterns/decorator/
categories: pattern_cat
tags: pattern_tag
---
......@@ -16,4 +17,4 @@ functionality.
* to add responsibilities to individual objects dynamically and transparently, that is, without affecting other objects
* 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
\ No newline at end of file
* 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
title: Dependency Injection
folder: dependency-injection
permalink: /patterns/dependency-injection/
categories: pattern_cat
tags: pattern_tag
---
......@@ -18,4 +19,4 @@ inversion of control and single responsibility principles.
**Applicability:** Use the Dependency Injection pattern when
* when you need to remove knowledge of concrete implementation from object
* to enable unit testing of classes in isolation using mock objects or stubs
\ No newline at end of file
* to enable unit testing of classes in isolation using mock objects or stubs
......@@ -2,6 +2,7 @@
layout: pattern
title: Double Checked Locking
folder: double-checked-locking
permalink: /patterns/double-checked-locking/
categories: pattern_cat
tags: pattern_tag
---
......@@ -16,4 +17,4 @@ actual locking logic proceed.
**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 on a method where method's behaviour changes according to the some constraints and these constraint change within this method.
\ No newline at end of file
* 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
title: Double Dispatch
folder: double-dispatch
permalink: /patterns/double-dispatch/
categories: pattern_cat
tags: pattern_tag
---
......@@ -17,4 +18,4 @@ behavior based on receiver and parameter types.
**Real world examples:**
* [ObjectOutputStream](https://docs.oracle.com/javase/8/docs/api/java/io/ObjectOutputStream.html)
\ No newline at end of file
* [ObjectOutputStream](https://docs.oracle.com/javase/8/docs/api/java/io/ObjectOutputStream.html)
......@@ -2,6 +2,7 @@
layout: pattern
title: Event Aggregator
folder: event-aggregator
permalink: /patterns/event-aggregator/
categories: pattern_cat
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
with them all, you can centralize the registration logic to the Event
Aggregator. As well as simplifying registration, a Event Aggregator also
simplifies the memory management issues in using observers.
\ No newline at end of file
simplifies the memory management issues in using observers.
......@@ -2,6 +2,7 @@
layout: pattern
title: Execute Around
folder: execute-around
permalink: /patterns/execute-around/
categories: pattern_cat
tags: pattern_tag
---
......@@ -15,4 +16,4 @@ only what to do with the resource.
**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.
\ No newline at end of file
* 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
title: Facade
folder: facade
permalink: /patterns/facade/
categories: pattern_cat
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.
* 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
\ No newline at end of file
* 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
title: Factory Method
folder: factory-method
permalink: /patterns/factory-method/
categories: creational
tags: pattern_tag
---
......@@ -16,4 +17,4 @@ instantiation to subclasses.
* a class can't anticipate the class of objects it must create
* 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
\ No newline at end of file
* 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
title: Flux
folder: flux
permalink: /patterns/flux/
categories: pattern_cat
tags: pattern_tag
---
......@@ -15,4 +16,4 @@ logic, which updates all of the views that are affected.
**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.
\ No newline at end of file
* 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
title: Flyweight
folder: flyweight
permalink: /patterns/flyweight/
categories: pattern_cat
tags: pattern_tag
---
......@@ -22,4 +23,4 @@ true
**Real world examples:**
* [java.lang.Integer#valueOf(int)](http://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html#valueOf%28int%29)
\ No newline at end of file
* [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
title: Front Controller
folder: front-controller
permalink: /patterns/front-controller/
categories: pattern_cat
tags: pattern_tag
---
......@@ -20,4 +21,4 @@ internationalization, routing and logging in a single place.
**Real world examples:**
* [Apache Struts](https://struts.apache.org/)
\ No newline at end of file
* [Apache Struts](https://struts.apache.org/)
......@@ -2,6 +2,7 @@
layout: pattern
title: Half-Sync/Half-Async
folder: half-sync-half-async
permalink: /patterns/half-sync-half-async/
categories: pattern_cat
tags: pattern_tag
---
......@@ -24,4 +25,4 @@ degrading execution efficiency.
* [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)
* [Android AsyncTask framework](http://developer.android.com/reference/android/os/AsyncTask.html)
\ No newline at end of file
* [Android AsyncTask framework](http://developer.android.com/reference/android/os/AsyncTask.html)
---
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)
\ No newline at end of file
......@@ -2,6 +2,7 @@
layout: pattern
title: Intercepting Filter
folder: intercepting-filter
permalink: /patterns/intercepting-filter/
categories: pattern_cat
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 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
\ No newline at end of file
* you want a modular approach to configuring pre-processing and post-processing schemes
......@@ -2,6 +2,7 @@
layout: pattern
title: Interpreter
folder: interpreter
permalink: /patterns/interpreter/
categories: pattern_cat
tags: pattern_tag
---
......@@ -16,4 +17,4 @@ language.
interpret, and you can represent statements in the language as abstract syntax
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
* 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
\ No newline at end of file
* 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
title: Introduction
folder: introduction
permalink: /patterns/introduction/
permalink: /patterns/introduction/
categories: pattern_cat
tags: pattern_tag
---
......@@ -15,4 +17,4 @@ development paradigms.
Reusing design patterns helps to prevent subtle issues that can cause major
problems, and it also improves code readability for coders and architects who
are familiar with the patterns.
\ No newline at end of file
are familiar with the patterns.
......@@ -2,6 +2,7 @@
layout: pattern
title: Iterator
folder: iterator
permalink: /patterns/iterator/
categories: pattern_cat
tags: pattern_tag
---
......@@ -19,4 +20,4 @@ sequentially without exposing its underlying representation.
**Real world examples:**
* [java.util.Iterator](http://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html)
\ No newline at end of file
* [java.util.Iterator](http://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html)
......@@ -2,6 +2,7 @@
layout: pattern
title: Lazy Loading
folder: lazy-loading
permalink: /patterns/lazy-loading/
categories: pattern_cat
tags: pattern_tag
---
......@@ -19,4 +20,4 @@ appropriately used.
**Real world examples:**
* JPA annotations @OneToOne, @OneToMany, @ManyToOne, @ManyToMany and fetch = FetchType.LAZY
\ No newline at end of file
* JPA annotations @OneToOne, @OneToMany, @ManyToOne, @ManyToMany and fetch = FetchType.LAZY
......@@ -2,6 +2,7 @@
layout: pattern
title: Mediator
folder: mediator
permalink: /patterns/mediator/
categories: pattern_cat
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
* 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
\ No newline at end of file
* a behavior that's distributed between several classes should be customizable without a lot of subclassing
......@@ -2,6 +2,7 @@
layout: pattern
title: Memento
folder: memento
permalink: /patterns/memento/
categories: pattern_cat
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:**
* [java.util.Date](http://docs.oracle.com/javase/8/docs/api/java/util/Date.html)
\ No newline at end of file
* [java.util.Date](http://docs.oracle.com/javase/8/docs/api/java/util/Date.html)
......@@ -2,6 +2,7 @@
layout: pattern
title: Model-View-Controller
folder: model-view-controller
permalink: /patterns/model-view-controller/
categories: pattern_cat
tags: pattern_tag
---
......@@ -15,4 +16,4 @@ display.
**Applicability:** Use the Model-View-Controller pattern when
* you want to clearly separate the domain data from its user interface representation
\ No newline at end of file
* you want to clearly separate the domain data from its user interface representation
......@@ -2,6 +2,7 @@
layout: pattern
title: Model-View-Presenter
folder: model-view-presenter
permalink: /patterns/model-view-presenter/
categories: pattern_cat
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
situations
* when you want to improve the "Separation of Concerns" principle in presentation logic
* when a user interface development and testing is necessary.
\ No newline at end of file
* when a user interface development and testing is necessary.
......@@ -2,6 +2,7 @@
layout: pattern
title: Multiton
folder: multiton
permalink: /patterns/multiton/
categories: pattern_cat
tags: pattern_tag
---
......@@ -13,4 +14,4 @@ global point of access to them.
**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
\ No newline at end of file
* 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
title: Naked Objects
folder: naked-objects
permalink: /patterns/naked-objects/
categories: pattern_cat
tags: pattern_tag
---
......@@ -20,4 +21,4 @@ everything else is autogenerated by the framework.
**Real world examples:**
* [Apache Isis](https://isis.apache.org/)
\ No newline at end of file
* [Apache Isis](https://isis.apache.org/)
......@@ -2,6 +2,7 @@
layout: pattern
title: Null Object
folder: null-object
permalink: /patterns/null-object/
categories: pattern_cat
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
* you want to avoid explicit null checks and keep the algorithm elegant and easy to read.
\ No newline at end of file
* you want to avoid explicit null checks and keep the algorithm elegant and easy to read.
......@@ -2,6 +2,7 @@
layout: pattern
title: Object Pool
folder: object-pool
permalink: /patterns/object-pool/
categories: pattern_cat
tags: pattern_tag
---
......@@ -16,4 +17,4 @@ are in use and which are available.
**Applicability:** Use the Object Pool pattern when
* the objects are expensive to create (allocation cost)
* you need a large number of short-lived objects (memory fragmentation)
\ No newline at end of file
* you need a large number of short-lived objects (memory fragmentation)
......@@ -2,6 +2,7 @@
layout: pattern
title: Observer
folder: observer
permalink: /patterns/observer/
categories: pattern_cat
tags: pattern_tag
---
......@@ -24,4 +25,4 @@ automatically.
**Real world examples:**
* [java.util.Observer](http://docs.oracle.com/javase/8/docs/api/java/util/Observer.html)
\ No newline at end of file
* [java.util.Observer](http://docs.oracle.com/javase/8/docs/api/java/util/Observer.html)
......@@ -2,6 +2,7 @@
layout: pattern
title: Poison Pill
folder: poison-pill
permalink: /patterns/poison-pill/
categories: pattern_cat
tags: pattern_tag
---
......@@ -17,4 +18,4 @@ graceful shutdown for separate distributed consumption process.
**Real world examples:**
* [akka.actor.PoisonPill](http://doc.akka.io/docs/akka/2.1.4/java/untyped-actors.html)
\ No newline at end of file
* [akka.actor.PoisonPill](http://doc.akka.io/docs/akka/2.1.4/java/untyped-actors.html)
......@@ -2,6 +2,7 @@
layout: pattern
title: Private Class Data
folder: private-class-data
permalink: /patterns/private-class-data/
categories: pattern_cat
tags: pattern_tag
---
......@@ -14,4 +15,4 @@ attributes by encapsulating them in single Data object.
**Applicability:** Use the Private Class Data pattern when
* you want to prevent write access to class data members
\ No newline at end of file
* you want to prevent write access to class data members
......@@ -2,6 +2,7 @@
layout: pattern
title: Property
folder: property
permalink: /patterns/property/
categories: pattern_cat
tags: pattern_tag
---
......@@ -17,4 +18,4 @@ objects as parents.
**Real world examples:**
* [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain) prototype inheritance
\ No newline at end of file
* [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain) prototype inheritance
......@@ -2,6 +2,7 @@
layout: pattern
title: Prototype
folder: prototype
permalink: /patterns/prototype/
categories: pattern_cat
tags: pattern_tag
---
......@@ -19,4 +20,4 @@ instance, and create new objects by copying this prototype.
**Real world examples:**
* [java.lang.Object#clone()](http://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone%28%29)
\ No newline at end of file
* [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
title: Proxy
folder: proxy
permalink: /patterns/proxy/
categories: pattern_cat
tags: pattern_tag
---
......@@ -30,4 +31,4 @@ are several common situations in which the Proxy pattern is applicable
**Real world examples:**
* [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/)
\ No newline at end of file
* [Apache Commons Proxy](https://commons.apache.org/proper/commons-proxy/)
......@@ -2,6 +2,7 @@
layout: pattern
title: Repository
folder: repository
permalink: /patterns/repository/
categories: pattern_cat
tags: pattern_tag
---
......@@ -23,4 +24,4 @@ querying is utilized.
**Real world examples:**
* [Spring Data](http://projects.spring.io/spring-data/)
\ No newline at end of file
* [Spring Data](http://projects.spring.io/spring-data/)
......@@ -2,6 +2,7 @@
layout: pattern
title: Resource Acquisition Is Initialization
folder: resource-acquisition-is-initialization
permalink: /patterns/resource-acquisition-is-initialization/
categories: pattern_cat
tags: pattern_tag
---
......@@ -12,4 +13,4 @@ tags: pattern_tag
**Applicability:** Use the Resource Acquisition Is Initialization pattern when
* you have resources that must be closed in every condition
\ No newline at end of file
* you have resources that must be closed in every condition
......@@ -2,6 +2,7 @@
layout: pattern
title: Servant
folder: servant
permalink: /patterns/servant/
categories: pattern_cat
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
* when we want some objects to perform a common action and don't want to define this action as a method in every class.
\ No newline at end of file
* 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
title: Service Layer
folder: service-layer
permalink: /patterns/service-layer/
categories: pattern_cat
tags: pattern_tag
---
......@@ -18,4 +19,4 @@ its business logic. The Service Layer fulfills this role.
**Applicability:** Use the Service Layer pattern when
* you want to encapsulate domain logic under API
* you need to implement multiple interfaces with common logic and data
\ No newline at end of file
* you need to implement multiple interfaces with common logic and data
......@@ -2,6 +2,7 @@
layout: pattern
title: Service Locator
folder: service-locator
permalink: /patterns/service-locator/
categories: pattern_cat
tags: pattern_tag
---
......@@ -24,4 +25,4 @@ improves the performance of application to great extent.
* when network hits are expensive and time consuming
* lookups of services are done quite frequently
* large number of services are being used
\ No newline at end of file
* large number of services are being used
......@@ -2,6 +2,7 @@
layout: pattern
title: Singleton
folder: singleton
permalink: /patterns/singleton/
categories: pattern_cat
tags: pattern_tag
---
......@@ -24,4 +25,4 @@ access to it.
**Real world examples:**
* [java.lang.Runtime#getRuntime()](http://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#getRuntime%28%29)
\ No newline at end of file
* [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
title: Specification
folder: specification
permalink: /patterns/specification/
categories: pattern_cat
tags: pattern_tag
---
......@@ -16,4 +17,4 @@ order
**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 check that only suitable objects are used for a certain role (validation)
\ No newline at end of file
* you need to check that only suitable objects are used for a certain role (validation)
......@@ -2,6 +2,7 @@
layout: pattern
title: State
folder: state
permalink: /patterns/state/
categories: pattern_cat
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
* 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.
\ No newline at end of file
* 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
title: Step Builder
folder: step-builder
permalink: /patterns/step-builder/
categories: pattern_cat
tags: pattern_tag
---
......@@ -11,4 +12,4 @@ The user experience will be much more improved by the fact that he will only see
![alt text](./etc/step-builder.png "Step Builder")
**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.
\ No newline at end of file
**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
title: Strategy
folder: strategy
permalink: /patterns/strategy/
categories: pattern_cat
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
* 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
* 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
\ No newline at end of file
* 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
title: Template method
folder: template-method
permalink: /patterns/template-method/
categories: pattern_cat
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
* 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
\ No newline at end of file
* 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
title: Thread Pool
folder: thread-pool
permalink: /patterns/thread-pool/
categories: pattern_cat
tags: pattern_tag
---
......@@ -16,4 +17,4 @@ and eliminating the latency of creating new threads.
**Applicability:** Use the Thread Pool pattern when
* you have a large number of short-lived tasks to be executed in parallel
\ No newline at end of file
* you have a large number of short-lived tasks to be executed in parallel
......@@ -2,6 +2,7 @@
layout: pattern
title: Tolerant Reader
folder: tolerant-reader
permalink: /patterns/tolerant-reader/
categories: pattern_cat
tags: pattern_tag
---
......@@ -15,4 +16,4 @@ changes, the readers must not break.
**Applicability:** Use the Tolerant Reader pattern when
* the communication schema can evolve and change and yet the receiving side should not break
\ No newline at end of file
* the communication schema can evolve and change and yet the receiving side should not break
......@@ -2,6 +2,7 @@
layout: pattern
title: Visitor
folder: visitor
permalink: /patterns/visitor/
categories: pattern_cat
tags: pattern_tag
---
......@@ -20,4 +21,4 @@ of the elements on which it operates.
**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)
\ No newline at end of file
* [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)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册