Skip to content

Commit fbb12b5

Browse files
MarkusMarkus
Markus
authored and
Markus
committed
Work towards #56: Splitting up the README
I did the job and splitted up the readme, hopefully everything was splitted correctly...
1 parent ea524ee commit fbb12b5

File tree

58 files changed

+1205
-759
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1205
-759
lines changed

README.md

+1-759
Large diffs are not rendered by default.

abstract-factory/index.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
layout: pattern
3+
title: Abstract Factory
4+
folder: abstract-factory
5+
categories:
6+
- pattern_cat
7+
- creational
8+
tags: pattern_tag
9+
---
10+
11+
**Intent:** Provide an interface for creating families of related or dependent
12+
objects without specifying their concrete classes.
13+
14+
![alt text](./etc/abstract-factory_1.png "Abstract Factory")
15+
16+
**Applicability:** Use the Abstract Factory pattern when
17+
18+
* a system should be independent of how its products are created, composed and represented
19+
* a system should be configured with one of multiple families of products
20+
* a family of related product objects is designed to be used together, and you need to enforce this constraint
21+
* you want to provide a class library of products, and you want to reveal just their interfaces, not their implementations
22+
23+
**Real world examples:**
24+
25+
* [javax.xml.parsers.DocumentBuilderFactory](http://docs.oracle.com/javase/8/docs/api/javax/xml/parsers/DocumentBuilderFactory.html)

adapter/index.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
layout: pattern
3+
title: Adapter
4+
folder: adapter
5+
categories: pattern_cat
6+
tags: pattern_tag
7+
---
8+
9+
**Intent:** Convert the interface of a class into another interface the clients
10+
expect. Adapter lets classes work together that couldn't otherwise because of
11+
incompatible interfaces.
12+
13+
![alt text](./etc/adapter_1.png "Adapter")
14+
15+
**Applicability:** Use the Adapter pattern when
16+
17+
* you want to use an existing class, and its interface does not match the one you need
18+
* you want to create a reusable class that cooperates with unrelated or unforeseen classes, that is, classes that don't necessarily have compatible interfaces
19+
* you need to use several existing subclasses, but it's impractical to adapt their interface by subclassing every one. An object adapter can adapt the interface of its parent class.
20+
21+
**Real world examples:**
22+
23+
* [java.util.Arrays#asList()](http://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html#asList%28T...%29)

async-method-invocation/index.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
layout: pattern
3+
title: Async Method Invocation
4+
folder: async-method-invocation
5+
categories: pattern_cat
6+
tags: pattern_tag
7+
---
8+
9+
**Intent:** Asynchronous method invocation is pattern where the calling thread
10+
is not blocked while waiting results of tasks. The pattern provides parallel
11+
processing of multiple independent tasks and retrieving the results via
12+
callbacks or waiting until everything is done.
13+
14+
![alt text](./etc/async-method-invocation.png "Async Method Invocation")
15+
16+
**Applicability:** Use async method invocation pattern when
17+
18+
* you have multiple independent tasks that can run in parallel
19+
* you need to improve the performance of a group of sequential tasks
20+
* you have limited amount of processing capacity or long running tasks and the
21+
caller should not wait the tasks to be ready
22+
23+
**Real world examples:**
24+
25+
* [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)
26+
* [Task-based Asynchronous Pattern](https://msdn.microsoft.com/en-us/library/hh873175.aspx) (.NET)

bridge/index.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
layout: pattern
3+
title: Bridge
4+
folder: bridge
5+
categories: pattern_cat
6+
tags: pattern_tag
7+
---
8+
9+
**Intent:** Decouple an abstraction from its implementation so that the two can
10+
vary independently.
11+
12+
13+
![alt text](./etc/bridge_1.png "Bridge")
14+
15+
**Applicability:** Use the Bridge pattern when
16+
17+
* you want to avoid a permanent binding between an abstraction and its implementation. This might be the case, for example, when the implementation must be selected or switched at run-time.
18+
* 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
19+
* changes in the implementation of an abstraction should have no impact on clients; that is, their code should not have to be recompiled.
20+
* 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
21+
* 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.

builder/index.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
layout: pattern
3+
title: Builder
4+
folder: builder
5+
categories: creational
6+
tags: pattern_tag
7+
---
8+
9+
**Intent:** Separate the construction of a complex object from its
10+
representation so that the same construction process can create different
11+
representations.
12+
13+
![alt text](./etc/builder_1.png "Builder")
14+
15+
**Applicability:** Use the Builder pattern when
16+
17+
* the algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled
18+
* the construction process must allow different representations for the object that's constructed
19+
20+
**Real world examples:**
21+
22+
* [java.lang.StringBuilder](http://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html)
23+
* [Apache Camel builders](https://github.com/apache/camel/tree/0e195428ee04531be27a0b659005e3aa8d159d23/camel-core/src/main/java/org/apache/camel/builder)

business-delegate/index.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
layout: pattern
3+
title: Business Delegate
4+
folder: business-delegate
5+
categories: pattern_cat
6+
tags: pattern_tag
7+
---
8+
9+
**Intent:** The Business Delegate pattern adds an abstraction layer between
10+
presentation and business tiers. By using the pattern we gain loose coupling
11+
between the tiers and encapsulate knowledge about how to locate, connect to,
12+
and interact with the business objects that make up the application.
13+
14+
![alt text](./etc/business-delegate.png "Business Delegate")
15+
16+
**Applicability:** Use the Business Delegate pattern when
17+
18+
* you want loose coupling between presentation and business tiers
19+
* you want to orchestrate calls to multiple business services
20+
* you want to encapsulate service lookups and service calls

callback/index.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
layout: pattern
3+
title: Callback
4+
folder: callback
5+
categories: pattern_cat
6+
tags: pattern_tag
7+
---
8+
9+
**Intent:** Callback is a piece of executable code that is passed as an
10+
argument to other code, which is expected to call back (execute) the argument
11+
at some convenient time.
12+
13+
![alt text](./etc/callback.png "Callback")
14+
15+
**Applicability:** Use the Callback pattern when
16+
17+
* when some arbitrary synchronous or asynchronous action must be performed after execution of some defined activity.
18+
19+
**Real world examples:**
20+
21+
* [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.

chain-of-responsibility/index.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
layout: pattern
3+
title: Chain of responsibility
4+
folder: chain-of-responsibility
5+
categories: pattern_cat
6+
tags: pattern_tag
7+
---
8+
9+
**Intent:** Avoid coupling the sender of a request to its receiver by giving
10+
more than one object a chance to handle the request. Chain the receiving
11+
objects and pass the request along the chain until an object handles it.
12+
13+
![alt text](./chain/etc/chain_1.png "Chain of Responsibility")
14+
15+
**Applicability:** Use Chain of Responsibility when
16+
17+
* more than one object may handle a request, and the handler isn't known a priori. The handler should be ascertained automatically
18+
* you want to issue a request to one of several objects without specifying the receiver explicitly
19+
* the set of objects that can handle a request should be specified dynamically
20+
21+
**Real world examples:**
22+
23+
* [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)
24+
* [Apache Commons Chain](https://commons.apache.org/proper/commons-chain/index.html)

command/index.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
layout: pattern
3+
title: Command
4+
folder: command
5+
categories: pattern_cat
6+
tags: pattern_tag
7+
---
8+
9+
**Intent:** Encapsulate a request as an object, thereby letting you
10+
parameterize clients with different requests, queue or log requests, and
11+
support undoable operations.
12+
13+
![alt text](./etc/command.png "Command")
14+
15+
**Applicability:** Use the Command pattern when you want to
16+
17+
* parameterize objects by an action to perform. You can express such parameterization in a procedural language with a callback function, that is, a function that's registered somewhere to be called at a later point. Commands are an object-oriented replacement for callbacks.
18+
* specify, queue, and execute requests at different times. A Command object can have a lifetime independent of the original request. If the receiver of a request can be represented in an address space-independent way, then you can transfer a command object for the request to a different process and fulfill the request there
19+
* support undo. The Command's execute operation can store state for reversing its effects in the command itself. The Command interface must have an added Unexecute operation that reverses the effects of a previous call to execute. Executed commands are stored in a history list. Unlimited-level undo and redo is achieved by traversing this list backwards and forwards calling unexecute and execute, respectively
20+
* support logging changes so that they can be reapplied in case of a system crash. By augmenting the Command interface with load and store operations, you can keep a persistent log of changes. Recovering from a crash involves reloading logged commands from disk and re-executing them with the execute operation
21+
* structure a system around high-level operations build on primitive operations. Such a structure is common in information systems that support transactions. A transaction encapsulates a set of changes to data. The Command pattern offers a way to model transactions. Commands have a common interface, letting you invoke all transactions the same way. The pattern also makes it easy to extend the system with new transactions
22+
23+
**Typical Use Case:**
24+
25+
* to keep a history of requests
26+
* implement callback functionality
27+
* implement the undo functionality
28+
29+
**Real world examples:**
30+
31+
* [java.lang.Runnable](http://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html)

composite/index.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
layout: pattern
3+
title: Composite
4+
folder: composite
5+
categories: pattern_cat
6+
tags: pattern_tag
7+
---
8+
9+
**Intent:** Compose objects into tree structures to represent part-whole
10+
hierarchies. Composite lets clients treat individual objects and compositions
11+
of objects uniformly.
12+
13+
![alt text](./etc/composite_1.png "Composite")
14+
15+
**Applicability:** Use the Composite pattern when
16+
17+
* you want to represent part-whole hierarchies of objects
18+
* you want clients to be able to ignore the difference between compositions of objects and individual objects. Clients will treat all objects in the composite structure uniformly
19+
20+
**Real world examples:**
21+
22+
* [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)
23+
* [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)

dao/index.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
layout: pattern
3+
title: Data Access Object
4+
folder: dao
5+
categories: pattern_cat
6+
tags: pattern_tag
7+
---
8+
9+
**Intent:** Object provides an abstract interface to some type of database or
10+
other persistence mechanism.
11+
12+
![alt text](./etc/dao.png "Data Access Object")
13+
14+
**Applicability:** Use the Data Access Object in any of the following situations
15+
16+
* when you want to consolidate how the data layer is accessed
17+
* when you want to avoid writing multiple data retrieval/persistence layers

decorator/index.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
layout: pattern
3+
title: Decorator
4+
folder: decorator
5+
categories: pattern_cat
6+
tags: pattern_tag
7+
---
8+
9+
**Intent:** Attach additional responsibilities to an object dynamically.
10+
Decorators provide a flexible alternative to subclassing for extending
11+
functionality.
12+
13+
![alt text](./etc/decorator_1.png "Decorator")
14+
15+
**Applicability:** Use Decorator
16+
17+
* to add responsibilities to individual objects dynamically and transparently, that is, without affecting other objects
18+
* for responsibilities that can be withdrawn
19+
* 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

dependency-injection/index.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
layout: pattern
3+
title: Dependency Injection
4+
folder: dependency-injection
5+
categories: pattern_cat
6+
tags: pattern_tag
7+
---
8+
9+
**Intent:** Dependency Injection is a software design pattern in which one or
10+
more dependencies (or services) are injected, or passed by reference, into a
11+
dependent object (or client) and are made part of the client's state. The
12+
pattern separates the creation of a client's dependencies from its own
13+
behavior, which allows program designs to be loosely coupled and to follow the
14+
inversion of control and single responsibility principles.
15+
16+
![alt text](./etc/dependency-injection.png "Dependency Injection")
17+
18+
**Applicability:** Use the Dependency Injection pattern when
19+
20+
* when you need to remove knowledge of concrete implementation from object
21+
* to enable unit testing of classes in isolation using mock objects or stubs

double-checked-locking/index.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
layout: pattern
3+
title: Double Checked Locking
4+
folder: double-checked-locking
5+
categories: pattern_cat
6+
tags: pattern_tag
7+
---
8+
9+
**Intent:** Reduce the overhead of acquiring a lock by first testing the
10+
locking criterion (the "lock hint") without actually acquiring the lock. Only
11+
if the locking criterion check indicates that locking is required does the
12+
actual locking logic proceed.
13+
14+
![alt text](./etc/double_checked_locking_1.png "Double Checked Locking")
15+
16+
**Applicability:** Use the Double Checked Locking pattern when
17+
18+
* 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.
19+
* 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.

double-dispatch/index.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
layout: pattern
3+
title: Double Dispatch
4+
folder: double-dispatch
5+
categories: pattern_cat
6+
tags: pattern_tag
7+
---
8+
9+
**Intent:** Double Dispatch pattern is a way to create maintainable dynamic
10+
behavior based on receiver and parameter types.
11+
12+
![alt text](./etc/double-dispatch.png "Double Dispatch")
13+
14+
**Applicability:** Use the Double Dispatch pattern when
15+
16+
* the dynamic behavior is not defined only based on receiving object's type but also on the receiving method's parameter type.
17+
18+
**Real world examples:**
19+
20+
* [ObjectOutputStream](https://docs.oracle.com/javase/8/docs/api/java/io/ObjectOutputStream.html)

event-aggregator/index.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
layout: pattern
3+
title: Event Aggregator
4+
folder: event-aggregator
5+
categories: pattern_cat
6+
tags: pattern_tag
7+
---
8+
9+
**Intent:** A system with lots of objects can lead to complexities when a
10+
client wants to subscribe to events. The client has to find and register for
11+
each object individually, if each object has multiple events then each event
12+
requires a separate subscription. An Event Aggregator acts as a single source
13+
of events for many objects. It registers for all the events of the many objects
14+
allowing clients to register with just the aggregator.
15+
16+
![alt text](./etc/classes.png "Event Aggregator")
17+
18+
**Applicability:** Use the Event Aggregator pattern when
19+
20+
* Event Aggregator is a good choice when you have lots of objects that are
21+
potential event sources. Rather than have the observer deal with registering
22+
with them all, you can centralize the registration logic to the Event
23+
Aggregator. As well as simplifying registration, a Event Aggregator also
24+
simplifies the memory management issues in using observers.

0 commit comments

Comments
 (0)