From b2b1ba95ebe41a147cf6908ce6d070fe48fb3dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Fri, 13 Dec 2019 21:09:28 +0200 Subject: [PATCH] https://github.com/iluwatar/java-design-patterns-web/issues/8 Update pattern categories and tags --- abstract-document/README.md | 3 +-- abstract-factory/README.md | 2 -- acyclic-visitor/README.md | 3 +-- adapter/README.md | 2 -- aggregator-microservices/README.md | 3 +-- ambassador/README.md | 3 +-- api-gateway/README.md | 5 ++--- async-method-invocation/README.md | 3 --- balking/README.md | 3 +-- bridge/README.md | 2 -- builder/README.md | 2 -- business-delegate/README.md | 5 ++--- bytecode/README.md | 3 +-- caching/README.md | 4 +--- callback/README.md | 7 ++----- chain/README.md | 2 -- circuit-breaker/README.md | 6 +++--- collection-pipeline/README.md | 8 +++----- combinator/README.md | 9 +++++---- command/README.md | 3 --- commander/README.md | 6 +++--- composite/README.md | 2 -- converter/README.md | 5 ++--- cqrs/README.md | 4 ++-- dao/README.md | 5 ++--- data-bus/README.md | 3 +-- data-locality/README.md | 5 ++--- data-mapper/README.md | 5 ++--- data-transfer-object/README.md | 5 +---- decorator/README.md | 3 +-- delegation/README.md | 5 ++--- dependency-injection/README.md | 5 ++--- dirty-flag/README.md | 5 ++--- double-buffer/README.md | 9 +++------ double-checked-locking/README.md | 6 ++---- double-dispatch/README.md | 6 ++---- eip-aggregator/README.md | 4 +--- eip-message-channel/README.md | 4 +--- eip-publish-subscribe/README.md | 4 +--- eip-splitter/README.md | 4 +--- eip-wire-tap/README.md | 4 +--- event-aggregator/README.md | 2 -- event-asynchronous/README.md | 4 +--- event-driven-architecture/README.md | 2 -- event-queue/README.md | 4 +--- event-sourcing/README.md | 2 -- execute-around/README.md | 7 +++---- extension-objects/README.md | 3 +-- facade/README.md | 3 +-- factory-kit/README.md | 4 +--- factory-method/README.md | 3 +-- feature-toggle/README.md | 3 +-- fluentinterface/README.md | 6 ++---- flux/README.md | 5 ++--- flyweight/README.md | 2 -- front-controller/README.md | 5 ++--- game-loop/README.md | 5 ++--- guarded-suspension/README.md | 4 ++-- half-sync-half-async/README.md | 3 +-- hexagonal/README.md | 5 +++-- intercepting-filter/README.md | 4 ++-- interpreter/README.md | 3 +-- iterator/README.md | 2 -- layers/README.md | 4 +--- lazy-loading/README.md | 5 +---- leader-election/README.md | 5 ++--- marker/README.md | 5 ++--- master-worker-pattern/README.md | 6 +++--- mediator/README.md | 3 +-- memento/README.md | 2 -- model-view-controller/README.md | 7 +++---- model-view-presenter/README.md | 9 ++++----- module/README.md | 5 ++--- monad/README.md | 10 ++++------ monostate/README.md | 9 ++++----- multiton/README.md | 3 +-- mute-idiom/README.md | 6 ++---- mutex/README.md | 12 ++++++------ naked-objects/README.md | 9 ++++----- null-object/README.md | 6 +++--- object-mother/README.md | 9 +++------ object-pool/README.md | 7 +++---- observer/README.md | 10 ++++------ page-object/README.md | 5 ++--- partial-response/README.md | 7 ++----- pipeline/README.md | 12 +++++------- poison-pill/README.md | 7 +++---- priority-queue/README.md | 3 +-- private-class-data/README.md | 8 +++----- producer-consumer/README.md | 7 ++----- promise/README.md | 9 +++------ property/README.md | 5 ++--- prototype/README.md | 11 +++++------ proxy/README.md | 4 ++-- queue-load-leveling/README.md | 5 ++--- reactor/README.md | 11 +++++------ reader-writer-lock/README.md | 6 +----- repository/README.md | 14 ++++++-------- resource-acquisition-is-initialization/README.md | 8 +++----- retry/README.md | 5 ++--- role-object/README.md | 16 ++++++++-------- saga/README.md | 11 +++++------ semaphore/README.md | 7 +++---- servant/README.md | 8 ++++---- serverless/README.md | 7 ++++--- service-layer/README.md | 7 +++---- service-locator/README.md | 11 +++++------ sharding/README.md | 6 +++--- singleton/README.md | 12 +++++------- spatial-partition/README.md | 8 +++++--- specification/README.md | 4 +--- state/README.md | 6 ++---- step-builder/README.md | 3 +-- strategy/README.md | 11 +++++------ subclass-sandbox/README.md | 10 +++------- template-method/README.md | 12 +++++++----- thread-pool/README.md | 4 +--- throttling/README.md | 7 +++---- tls/README.md | 10 ++++------ tolerant-reader/README.md | 5 ++--- trampoline/README.md | 6 +++--- twin/README.md | 11 +++++------ typeobjectpattern/README.md | 8 +++++--- unit-of-work/README.md | 5 +---- update-method/README.md | 7 ++----- value-object/README.md | 5 ++--- visitor/README.md | 8 +++----- 127 files changed, 282 insertions(+), 450 deletions(-) diff --git a/abstract-document/README.md b/abstract-document/README.md index e9a2bed94..15f5c6c85 100644 --- a/abstract-document/README.md +++ b/abstract-document/README.md @@ -5,8 +5,7 @@ folder: abstract-document permalink: /patterns/abstract-document/ categories: Structural tags: - - Java - - Difficulty-Intermediate + - Extensibility --- ## Intent diff --git a/abstract-factory/README.md b/abstract-factory/README.md index a4fc5cc74..a2410e7f2 100644 --- a/abstract-factory/README.md +++ b/abstract-factory/README.md @@ -5,9 +5,7 @@ folder: abstract-factory permalink: /patterns/abstract-factory/ categories: Creational tags: - - Java - Gang Of Four - - Difficulty-Intermediate --- ## Also known as diff --git a/acyclic-visitor/README.md b/acyclic-visitor/README.md index cc5f467b7..f293e4393 100644 --- a/acyclic-visitor/README.md +++ b/acyclic-visitor/README.md @@ -5,8 +5,7 @@ folder: acyclic-visitor permalink: /patterns/acyclic-visitor/ categories: Behavioral tags: - - Java - - Difficulty-Intermediate + - Extensibility --- ## Intent diff --git a/adapter/README.md b/adapter/README.md index b1ad775cf..d10af7c2c 100644 --- a/adapter/README.md +++ b/adapter/README.md @@ -5,9 +5,7 @@ folder: adapter permalink: /patterns/adapter/ categories: Structural tags: - - Java - Gang Of Four - - Difficulty-Beginner --- ## Also known as diff --git a/aggregator-microservices/README.md b/aggregator-microservices/README.md index c3498d315..4d64178a6 100644 --- a/aggregator-microservices/README.md +++ b/aggregator-microservices/README.md @@ -5,8 +5,7 @@ folder: aggregator-microservices permalink: /patterns/aggregator-microservices/ categories: Architectural tags: -- Java -- Spring +- Cloud distributed --- ## Intent diff --git a/ambassador/README.md b/ambassador/README.md index 862c579a0..78b3a8856 100644 --- a/ambassador/README.md +++ b/ambassador/README.md @@ -5,8 +5,7 @@ folder: ambassador permalink: /patterns/ambassador/ categories: Structural tags: - - Java - - Difficulty-Intermediate + - Decoupling --- ## Intent diff --git a/api-gateway/README.md b/api-gateway/README.md index 2fd04900e..3a4f13e35 100644 --- a/api-gateway/README.md +++ b/api-gateway/README.md @@ -5,9 +5,8 @@ folder: api-gateway permalink: /patterns/api-gateway/ categories: Architectural tags: -- Java -- Difficulty-Intermediate -- Spring +- Cloud distributed +- Decoupling --- ## Intent diff --git a/async-method-invocation/README.md b/async-method-invocation/README.md index f1faa396d..d1bda1a52 100644 --- a/async-method-invocation/README.md +++ b/async-method-invocation/README.md @@ -5,9 +5,6 @@ folder: async-method-invocation permalink: /patterns/async-method-invocation/ categories: Concurrency tags: - - Java - - Difficulty-Intermediate - - Functional - Reactive --- diff --git a/balking/README.md b/balking/README.md index 36a3efcb9..22257ac7b 100644 --- a/balking/README.md +++ b/balking/README.md @@ -5,8 +5,7 @@ folder: balking permalink: /patterns/balking/ categories: Concurrency tags: - - Java - - Difficulty-Beginner + - Decoupling --- ## Intent diff --git a/bridge/README.md b/bridge/README.md index c48e1025c..5c1a183e4 100644 --- a/bridge/README.md +++ b/bridge/README.md @@ -5,9 +5,7 @@ folder: bridge permalink: /patterns/bridge/ categories: Structural tags: - - Java - Gang Of Four - - Difficulty-Intermediate --- ## Also known as diff --git a/builder/README.md b/builder/README.md index c6190ef17..fa680e0e5 100644 --- a/builder/README.md +++ b/builder/README.md @@ -5,9 +5,7 @@ folder: builder permalink: /patterns/builder/ categories: Creational tags: - - Java - Gang Of Four - - Difficulty-Intermediate --- ## Intent diff --git a/business-delegate/README.md b/business-delegate/README.md index 5debebbba..38eb591b8 100644 --- a/business-delegate/README.md +++ b/business-delegate/README.md @@ -3,10 +3,9 @@ layout: pattern title: Business Delegate folder: business-delegate permalink: /patterns/business-delegate/ -categories: Business Tier +categories: Structural tags: - - Java - - Difficulty-Intermediate + - Decoupling --- ## Intent diff --git a/bytecode/README.md b/bytecode/README.md index 13d8013d6..ee3f96ed8 100644 --- a/bytecode/README.md +++ b/bytecode/README.md @@ -5,8 +5,7 @@ folder: bytecode permalink: /patterns/bytecode/ categories: Behavioral tags: - - Java - - Difficulty-Beginner + - Game programming --- ## Intent diff --git a/caching/README.md b/caching/README.md index 34fe0222a..4172cc72a 100644 --- a/caching/README.md +++ b/caching/README.md @@ -3,10 +3,8 @@ layout: pattern title: Caching folder: caching permalink: /patterns/caching/ -categories: Other +categories: Behavioral tags: - - Java - - Difficulty-Intermediate - Performance --- diff --git a/callback/README.md b/callback/README.md index 27af6337c..6942019f3 100644 --- a/callback/README.md +++ b/callback/README.md @@ -3,12 +3,9 @@ layout: pattern title: Callback folder: callback permalink: /patterns/callback/ -categories: Other +categories: Idiom tags: - - Java - - Difficulty-Beginner - - Functional - - Idiom + - Reactive --- ## Intent diff --git a/chain/README.md b/chain/README.md index 7fdc4243b..dc247d482 100644 --- a/chain/README.md +++ b/chain/README.md @@ -5,9 +5,7 @@ folder: chain permalink: /patterns/chain/ categories: Behavioral tags: - - Java - Gang Of Four - - Difficulty-Intermediate --- ## Intent diff --git a/circuit-breaker/README.md b/circuit-breaker/README.md index 8e840ce1e..e0ef7d1fb 100644 --- a/circuit-breaker/README.md +++ b/circuit-breaker/README.md @@ -3,11 +3,10 @@ layout: pattern title: Circuit Breaker folder: circuit-breaker permalink: /patterns/circuit-breaker/ -categories: Other +categories: Behavioral tags: - - Java - Performance - - Difficulty-Intermediate + - Decoupling --- ## Intent @@ -179,6 +178,7 @@ Use the Circuit Breaker pattern when - [Retry Pattern](https://github.com/iluwatar/java-design-patterns/tree/master/retry) ## Real world examples + * [Spring Circuit Breaker module](https://spring.io/guides/gs/circuit-breaker) * [Netflix Hystrix API](https://github.com/Netflix/Hystrix) diff --git a/collection-pipeline/README.md b/collection-pipeline/README.md index 3f223dd07..8cf1a7c96 100644 --- a/collection-pipeline/README.md +++ b/collection-pipeline/README.md @@ -3,11 +3,9 @@ layout: pattern title: Collection Pipeline folder: collection-pipeline permalink: /patterns/collection-pipeline/ -categories: Other +categories: Functional tags: - - Java - - Difficulty-Beginner - - Functional + - Reactive --- ## Intent @@ -28,4 +26,4 @@ Use the Collection Pipeline pattern when * [Function composition and the Collection Pipeline pattern](https://www.ibm.com/developerworks/library/j-java8idioms2/index.html) * [Martin Fowler](https://martinfowler.com/articles/collection-pipeline/) -* [Java8 Streams](https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html) \ No newline at end of file +* [Java8 Streams](https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html) diff --git a/combinator/README.md b/combinator/README.md index 98d353050..6fa727a3f 100644 --- a/combinator/README.md +++ b/combinator/README.md @@ -3,11 +3,9 @@ layout: pattern title: Combinator folder: combinator permalink: /patterns/combinator/ -categories: Behavioral +categories: Idiom tags: - - Functional - Reactive - - Idiom --- ## Also known as @@ -23,13 +21,16 @@ and some "combinators" which can combine values of type T in various ways to bui ## Applicability Use the combinator pattern when: + - You are able to create a more complex value from more plain values but having the same type(a combination of them) ## Real world examples + - java.util.function.Function#compose - java.util.function.Function#andThen ## Credits + - [Example for java](https://gtrefs.github.io/code/combinator-pattern/) - [Combinator pattern](https://wiki.haskell.org/Combinator_pattern) -- [Combinatory logic](https://wiki.haskell.org/Combinatory_logic) \ No newline at end of file +- [Combinatory logic](https://wiki.haskell.org/Combinatory_logic) diff --git a/command/README.md b/command/README.md index bbe149df0..c5f471ce2 100644 --- a/command/README.md +++ b/command/README.md @@ -5,10 +5,7 @@ folder: command permalink: /patterns/command/ categories: Behavioral tags: - - Java - Gang Of Four - - Difficulty-Intermediate - - Functional --- ## Also known as diff --git a/commander/README.md b/commander/README.md index 0cee5dc77..d8f7c1c5a 100644 --- a/commander/README.md +++ b/commander/README.md @@ -3,10 +3,9 @@ layout: pattern title: Commander folder: commander permalink: /patterns/commander/ -categories: Other +categories: Concurrency tags: - - Java - - Difficulty-Intermediate + - Cloud distributed --- ## Intent @@ -24,4 +23,5 @@ Handling distributed transactions can be tricky, but if we choose to not handle We need a mechanism in place which can handle these kinds of situations. We have to direct the order to either one of the services (in this example, shipping) and then add the order into the database of the other service (in this example, payment), since two databses cannot be updated atomically. If currently unable to do it, there should be a queue where this request can be queued, and there has to be a mechanism which allows for a failure in the queueing as well. All this needs to be done by constant retries while ensuring idempotence (even if the request is made several times, the change should only be applied once) by a commander class, to reach a state of eventual consistency. ## Credits + * [https://www.grahamlea.com/2016/08/distributed-transactions-microservices-icebergs/] diff --git a/composite/README.md b/composite/README.md index ba939b803..e62897f2c 100644 --- a/composite/README.md +++ b/composite/README.md @@ -5,9 +5,7 @@ folder: composite permalink: /patterns/composite/ categories: Structural tags: - - Java - Gang Of Four - - Difficulty-Intermediate --- ## Intent diff --git a/converter/README.md b/converter/README.md index 824d47e38..a4e3d4bb8 100644 --- a/converter/README.md +++ b/converter/README.md @@ -3,10 +3,9 @@ layout: pattern title: Converter folder: converter permalink: /patterns/converter/ -categories: Business Tier +categories: Creational tags: - - Java - - Difficulty-Beginner + - Decoupling --- ## Intent diff --git a/cqrs/README.md b/cqrs/README.md index b9cbeacd8..431ae6279 100644 --- a/cqrs/README.md +++ b/cqrs/README.md @@ -5,8 +5,8 @@ folder: cqrs permalink: /patterns/cqrs/ categories: Architectural tags: - - Java - - Difficulty-Intermediate + - Performance + - Cloud distributed --- ## Intent diff --git a/dao/README.md b/dao/README.md index e1120fbf2..9065cb3ee 100644 --- a/dao/README.md +++ b/dao/README.md @@ -3,10 +3,9 @@ layout: pattern title: Data Access Object folder: dao permalink: /patterns/dao/ -categories: Persistence Tier +categories: Architectural tags: - - Java - - Difficulty-Beginner + - Data access --- ## Intent diff --git a/data-bus/README.md b/data-bus/README.md index 428c4db96..cf54beb32 100644 --- a/data-bus/README.md +++ b/data-bus/README.md @@ -6,8 +6,7 @@ permalink: /patterns/data-bus/ categories: Architectural tags: - - Java - - Difficulty-Intermediate + - Decoupling --- ## Intent diff --git a/data-locality/README.md b/data-locality/README.md index 8811e59ac..cabf7ab03 100644 --- a/data-locality/README.md +++ b/data-locality/README.md @@ -3,10 +3,9 @@ layout: pattern title: Data Locality folder: data-locality permalink: /patterns/data-locality/ -categories: Other +categories: Behavioral tags: - - Java - - Difficulty-Intermediate + - Game programming - Performance --- diff --git a/data-mapper/README.md b/data-mapper/README.md index f23d5a62a..fe0af9236 100644 --- a/data-mapper/README.md +++ b/data-mapper/README.md @@ -3,10 +3,9 @@ layout: pattern title: Data Mapper folder: data-mapper permalink: /patterns/data-mapper/ -categories: Persistence Tier +categories: Architectural tags: - - Java - - Difficulty-Beginner + - Decoupling --- ## Intent diff --git a/data-transfer-object/README.md b/data-transfer-object/README.md index c02379527..f269fc66b 100644 --- a/data-transfer-object/README.md +++ b/data-transfer-object/README.md @@ -5,10 +5,7 @@ folder: data-transfer-object permalink: /patterns/data-transfer-object/ categories: Architectural tags: - - Java - - KISS - - YAGNI - - Difficulty-Beginner + - Performance --- ## Intent diff --git a/decorator/README.md b/decorator/README.md index 6adb5d057..11605dee8 100644 --- a/decorator/README.md +++ b/decorator/README.md @@ -5,9 +5,8 @@ folder: decorator permalink: /patterns/decorator/ categories: Structural tags: - - Java - Gang Of Four - - Difficulty-Beginner + - Extensibility --- ## Also known as diff --git a/delegation/README.md b/delegation/README.md index b18c6f7f3..25bd16dc2 100644 --- a/delegation/README.md +++ b/delegation/README.md @@ -3,10 +3,9 @@ layout: pattern title: Delegation folder: delegation permalink: /patterns/delegation/ -categories: Behavioral +categories: Structural tags: - - Java - - Difficulty-Beginner + - Decoupling --- ## Also known as diff --git a/dependency-injection/README.md b/dependency-injection/README.md index ba81dc703..90edd4061 100644 --- a/dependency-injection/README.md +++ b/dependency-injection/README.md @@ -3,10 +3,9 @@ layout: pattern title: Dependency Injection folder: dependency-injection permalink: /patterns/dependency-injection/ -categories: Behavioral +categories: Creational tags: - - Java - - Difficulty-Beginner + - Decoupling --- ## Intent diff --git a/dirty-flag/README.md b/dirty-flag/README.md index 885c7f03b..31cfbae1f 100644 --- a/dirty-flag/README.md +++ b/dirty-flag/README.md @@ -3,10 +3,9 @@ layout: pattern title: Dirty Flag folder: dirty-flag permalink: /patterns/dirty-flag/ -categories: Other +categories: Behavioral tags: - - Java - - Difficulty-Beginner + - Game programming - Performance --- diff --git a/double-buffer/README.md b/double-buffer/README.md index d187ee2e2..d5a6136f3 100644 --- a/double-buffer/README.md +++ b/double-buffer/README.md @@ -3,10 +3,10 @@ layout: pattern title: Double Buffer folder: double-buffer permalink: /patterns/double-buffer/ -categories: Other +categories: Behavioral tags: - - Java - - Difficulty-Beginner + - Performance + - Game programming --- ## Intent @@ -19,11 +19,8 @@ Double buffering is a term used to describe a device that has two buffers. The u This pattern is one of those ones where you’ll know when you need it. If you have a system that lacks double buffering, it will probably look visibly wrong (tearing, etc.) or will behave incorrectly. But saying, “you’ll know when you need it” doesn’t give you much to go on. More specifically, this pattern is appropriate when all of these are true: - We have some state that is being modified incrementally. - - That same state may be accessed in the middle of modification. - - We want to prevent the code that’s accessing the state from seeing the work in progress. - - We want to be able to read the state and we don’t want to have to wait while it’s being written. ## Credits diff --git a/double-checked-locking/README.md b/double-checked-locking/README.md index d1077951a..64bf1522c 100644 --- a/double-checked-locking/README.md +++ b/double-checked-locking/README.md @@ -3,11 +3,9 @@ layout: pattern title: Double Checked Locking folder: double-checked-locking permalink: /patterns/double-checked-locking/ -categories: Concurrency +categories: Idiom tags: - - Java - - Difficulty-Beginner - - Idiom + - Performance --- ## Intent diff --git a/double-dispatch/README.md b/double-dispatch/README.md index dfc86a827..22e7a7235 100644 --- a/double-dispatch/README.md +++ b/double-dispatch/README.md @@ -3,11 +3,9 @@ layout: pattern title: Double Dispatch folder: double-dispatch permalink: /patterns/double-dispatch/ -categories: Other +categories: Idiom tags: - - Java - - Difficulty-Intermediate - - Idiom + - Extensibility --- ## Intent diff --git a/eip-aggregator/README.md b/eip-aggregator/README.md index 2b55b4e09..6138af0a8 100644 --- a/eip-aggregator/README.md +++ b/eip-aggregator/README.md @@ -5,9 +5,7 @@ folder: eip-aggregator permalink: /patterns/eip-aggregator/ categories: Integration tags: - - Java - - Difficulty-Intermittent - - EIP + - Enterprise Integration Pattern --- ## Intent diff --git a/eip-message-channel/README.md b/eip-message-channel/README.md index f43072f52..8e2f5dc8f 100644 --- a/eip-message-channel/README.md +++ b/eip-message-channel/README.md @@ -5,9 +5,7 @@ folder: eip-message-channel permalink: /patterns/eip-message-channel/ categories: Integration tags: - - Java - - EIP - - Apache Camel™ + - Enterprise Integration Pattern --- ## Intent diff --git a/eip-publish-subscribe/README.md b/eip-publish-subscribe/README.md index f9ec20fdf..3952913af 100644 --- a/eip-publish-subscribe/README.md +++ b/eip-publish-subscribe/README.md @@ -5,9 +5,7 @@ folder: eip-publish-subscribe permalink: /patterns/eip-publish-subscribe/ categories: Integration tags: - - Java - - EIP - - Apache Camel™ + - Enterprise Integration Pattern --- ## Intent diff --git a/eip-splitter/README.md b/eip-splitter/README.md index a2eedbb38..648462229 100644 --- a/eip-splitter/README.md +++ b/eip-splitter/README.md @@ -5,9 +5,7 @@ folder: eip-splitter permalink: /patterns/eip-splitter/ categories: Integration tags: - - Java - - Difficulty-Intermittent - - EIP + - Enterprise Integration Pattern --- ## Intent diff --git a/eip-wire-tap/README.md b/eip-wire-tap/README.md index b4609975e..83b43dfd1 100644 --- a/eip-wire-tap/README.md +++ b/eip-wire-tap/README.md @@ -5,9 +5,7 @@ folder: eip-wire-tap permalink: /patterns/eip-wire-tap/ categories: Integration tags: - - Java - - Difficulty-Intermittent - - EIP + - Enterprise Integration Pattern --- ## Intent diff --git a/event-aggregator/README.md b/event-aggregator/README.md index 79965bce1..5a8eb9685 100644 --- a/event-aggregator/README.md +++ b/event-aggregator/README.md @@ -5,8 +5,6 @@ folder: event-aggregator permalink: /patterns/event-aggregator/ categories: Structural tags: - - Java - - Difficulty-Beginner - Reactive --- diff --git a/event-asynchronous/README.md b/event-asynchronous/README.md index 68684e6ed..397d675e7 100644 --- a/event-asynchronous/README.md +++ b/event-asynchronous/README.md @@ -5,9 +5,7 @@ folder: event-asynchronous permalink: /patterns/event-asynchronous/ categories: Concurrency tags: - - difficulty-intermediate - - performance - - Java + - Reactive --- ## Intent diff --git a/event-driven-architecture/README.md b/event-driven-architecture/README.md index 5fcce357f..b0083d38b 100644 --- a/event-driven-architecture/README.md +++ b/event-driven-architecture/README.md @@ -5,8 +5,6 @@ folder: event-driven-architecture permalink: /patterns/event-driven-architecture/ categories: Architectural tags: - - Java - - Difficulty-Intermediate - Reactive --- diff --git a/event-queue/README.md b/event-queue/README.md index b4d7a071f..f0bec2638 100644 --- a/event-queue/README.md +++ b/event-queue/README.md @@ -5,9 +5,7 @@ folder: event-queue permalink: /patterns/event-queue/ categories: Concurrency tags: - - Java - - Difficulty Intermediate - - Queue + - Game programming --- ## Intent diff --git a/event-sourcing/README.md b/event-sourcing/README.md index 9e577af6c..5efbbbd02 100644 --- a/event-sourcing/README.md +++ b/event-sourcing/README.md @@ -5,8 +5,6 @@ folder: event-sourcing permalink: /patterns/event-sourcing/ categories: Architectural tags: - - Java - - Difficulty Intermediate - Performance --- diff --git a/execute-around/README.md b/execute-around/README.md index 9af46812e..677a97a6e 100644 --- a/execute-around/README.md +++ b/execute-around/README.md @@ -3,11 +3,9 @@ layout: pattern title: Execute Around folder: execute-around permalink: /patterns/execute-around/ -categories: Other +categories: Idiom tags: - - Java - - Difficulty-Beginner - - Idiom + - Extensibility --- ## Intent @@ -25,4 +23,5 @@ 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. ## Credits + * [Functional Programming in Java: Harnessing the Power of Java 8 Lambda Expressions](http://www.amazon.com/Functional-Programming-Java-Harnessing-Expressions/dp/1937785467/ref=sr_1_1) diff --git a/extension-objects/README.md b/extension-objects/README.md index 5b0da5cf4..64964a5fe 100644 --- a/extension-objects/README.md +++ b/extension-objects/README.md @@ -5,8 +5,7 @@ folder: extension-objects permalink: /patterns/extension-objects/ categories: Behavioral tags: - - Java - - Difficulty-Intermediate + - Extensibility --- ## Intent diff --git a/facade/README.md b/facade/README.md index 89a6a32e9..420001498 100644 --- a/facade/README.md +++ b/facade/README.md @@ -5,9 +5,8 @@ folder: facade permalink: /patterns/facade/ categories: Structural tags: - - Java - Gang Of Four - - Difficulty-Beginner + - Decoupling --- ## Intent diff --git a/factory-kit/README.md b/factory-kit/README.md index f374886d4..6183ac87f 100644 --- a/factory-kit/README.md +++ b/factory-kit/README.md @@ -5,9 +5,7 @@ folder: factory-kit permalink: /patterns/factory-kit/ categories: Creational tags: - - Java - - Difficulty-Beginner - - Functional + - Extensibility --- ## Intent diff --git a/factory-method/README.md b/factory-method/README.md index 37ab74393..18cbba2e4 100644 --- a/factory-method/README.md +++ b/factory-method/README.md @@ -5,8 +5,7 @@ folder: factory-method permalink: /patterns/factory-method/ categories: Creational tags: - - Java - - Difficulty-Beginner + - Extensibility - Gang Of Four --- diff --git a/feature-toggle/README.md b/feature-toggle/README.md index b4ba16cb4..a3a76f05a 100644 --- a/feature-toggle/README.md +++ b/feature-toggle/README.md @@ -5,8 +5,7 @@ folder: feature-toggle permalink: /patterns/feature-toggle/ categories: Behavioral tags: - - Java - - Difficulty-Beginner + - Extensibility --- ## Also known as diff --git a/fluentinterface/README.md b/fluentinterface/README.md index 08e1275e9..3068468b9 100644 --- a/fluentinterface/README.md +++ b/fluentinterface/README.md @@ -3,11 +3,9 @@ layout: pattern title: Fluent Interface folder: fluentinterface permalink: /patterns/fluentinterface/ -categories: Other +categories: Functional tags: - - Java - - Difficulty-Intermediate - - Functional + - Reactive --- ## Intent diff --git a/flux/README.md b/flux/README.md index 43e791509..0a2ea0b81 100644 --- a/flux/README.md +++ b/flux/README.md @@ -3,10 +3,9 @@ layout: pattern title: Flux folder: flux permalink: /patterns/flux/ -categories: Presentation Tier +categories: Structural tags: - - Java - - Difficulty-Intermediate + - Decoupling --- ## Intent diff --git a/flyweight/README.md b/flyweight/README.md index ff2ddcfe6..4847b8285 100644 --- a/flyweight/README.md +++ b/flyweight/README.md @@ -5,9 +5,7 @@ folder: flyweight permalink: /patterns/flyweight/ categories: Structural tags: - - Java - Gang Of Four - - Difficulty-Intermediate - Performance --- diff --git a/front-controller/README.md b/front-controller/README.md index 3126e5e24..f4a2da970 100644 --- a/front-controller/README.md +++ b/front-controller/README.md @@ -3,10 +3,9 @@ layout: pattern title: Front Controller folder: front-controller permalink: /patterns/front-controller/ -categories: Presentation Tier +categories: Structural tags: - - Java - - Difficulty-Intermediate + - Decoupling --- ## Intent diff --git a/game-loop/README.md b/game-loop/README.md index 566ea37f3..f0a7eeebb 100644 --- a/game-loop/README.md +++ b/game-loop/README.md @@ -3,10 +3,9 @@ layout: pattern title: Game Loop folder: game-loop permalink: /patterns/game-loop/ -categories: Other +categories: Behavioral tags: - - Java - - Difficulty-Beginner + - Game programming --- ## Intent diff --git a/guarded-suspension/README.md b/guarded-suspension/README.md index 28ffa9d98..83e6b4fdf 100644 --- a/guarded-suspension/README.md +++ b/guarded-suspension/README.md @@ -5,8 +5,7 @@ folder: guarded-suspension permalink: /patterns/guarded-suspension/ categories: Concurrency tags: - - Java - - Difficulty-Beginner + - Decoupling --- ## Intent @@ -19,4 +18,5 @@ Use Guarded suspension pattern to handle a situation when you want to execute a Use Guarded Suspension pattern when the developer knows that the method execution will be blocked for a finite period of time ## Related patterns + * Balking diff --git a/half-sync-half-async/README.md b/half-sync-half-async/README.md index 4ad350d59..5cfb411e5 100644 --- a/half-sync-half-async/README.md +++ b/half-sync-half-async/README.md @@ -5,8 +5,7 @@ folder: half-sync-half-async permalink: /patterns/half-sync-half-async/ categories: Concurrency tags: - - Java - - Difficulty-Intermediate + - Performance --- ## Intent diff --git a/hexagonal/README.md b/hexagonal/README.md index eb5ef0987..c478efafd 100644 --- a/hexagonal/README.md +++ b/hexagonal/README.md @@ -6,11 +6,11 @@ permalink: /patterns/hexagonal/ pumlformat: svg categories: Architectural tags: - - Java - - Difficulty-Expert + - Decoupling --- ## Also known as + * Ports and Adapters * Clean Architecture * Onion Architecture @@ -28,6 +28,7 @@ Use Hexagonal Architecture pattern when * When it is important that the application highly maintainable and fully testable ## Tutorials + * [Build Maintainable Systems With Hexagonal Architecture](http://java-design-patterns.com/blog/build-maintainable-systems-with-hexagonal-architecture/) ## Real world examples diff --git a/intercepting-filter/README.md b/intercepting-filter/README.md index 660d67e3d..39188810d 100644 --- a/intercepting-filter/README.md +++ b/intercepting-filter/README.md @@ -5,8 +5,7 @@ folder: intercepting-filter permalink: /patterns/intercepting-filter/ categories: Behavioral tags: - - Java - - Difficulty-Intermediate + - Decoupling --- ## Intent @@ -24,6 +23,7 @@ Use the Intercepting Filter pattern when * you want a modular approach to configuring pre-processing and post-processing schemes ## Tutorials + * [Introduction to Intercepting Filter Pattern in Java](https://www.baeldung.com/intercepting-filter-pattern-in-java) ## Real world examples diff --git a/interpreter/README.md b/interpreter/README.md index 634945005..d3dbc6bf3 100644 --- a/interpreter/README.md +++ b/interpreter/README.md @@ -5,9 +5,7 @@ folder: interpreter permalink: /patterns/interpreter/ categories: Behavioral tags: - - Java - Gang Of Four - - Difficulty-Intermediate --- ## Intent @@ -27,6 +25,7 @@ trees. The Interpreter pattern works best when * 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 ## Real world examples + * [java.util.Pattern](http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html) * [java.text.Normalizer](http://docs.oracle.com/javase/8/docs/api/java/text/Normalizer.html) * All subclasses of [java.text.Format](http://docs.oracle.com/javase/8/docs/api/java/text/Format.html) diff --git a/iterator/README.md b/iterator/README.md index 3dfcb1085..fd18045fa 100644 --- a/iterator/README.md +++ b/iterator/README.md @@ -5,8 +5,6 @@ folder: iterator permalink: /patterns/iterator/ categories: Behavioral tags: - - Java - - Difficulty-Beginner - Gang Of Four --- diff --git a/layers/README.md b/layers/README.md index 66a5c9c32..58c9cd828 100644 --- a/layers/README.md +++ b/layers/README.md @@ -6,9 +6,7 @@ permalink: /patterns/layers/ pumlformat: svg categories: Architectural tags: - - Java - - Difficulty-Intermediate - - Spring + - Decoupling --- ## Intent diff --git a/lazy-loading/README.md b/lazy-loading/README.md index 8156b3524..997149b03 100644 --- a/lazy-loading/README.md +++ b/lazy-loading/README.md @@ -3,11 +3,8 @@ layout: pattern title: Lazy Loading folder: lazy-loading permalink: /patterns/lazy-loading/ -categories: Other +categories: Idiom tags: - - Java - - Difficulty-Beginner - - Idiom - Performance --- diff --git a/leader-election/README.md b/leader-election/README.md index 15f2f9341..e6b2428dd 100644 --- a/leader-election/README.md +++ b/leader-election/README.md @@ -3,10 +3,9 @@ layout: pattern title: Leader Election folder: leader-election permalink: /patterns/leader-election/ -categories: Other +categories: Behavioral tags: - - Java - - Difficulty-Beginner + - Cloud distributed --- ## Intent diff --git a/marker/README.md b/marker/README.md index 70e92480e..a411827c3 100644 --- a/marker/README.md +++ b/marker/README.md @@ -3,10 +3,9 @@ layout: pattern title: Marker Interface folder: marker permalink: /patterns/marker/ -categories: Other +categories: Structural tags: - - Java - - Difficulty-Beginner + - Decoupling --- ## Intent diff --git a/master-worker-pattern/README.md b/master-worker-pattern/README.md index 239b83fde..876d9206c 100644 --- a/master-worker-pattern/README.md +++ b/master-worker-pattern/README.md @@ -3,10 +3,9 @@ layout: pattern title: Master-Worker folder: master-worker-pattern permalink: /patterns/master-worker-pattern/ -categories: Other +categories: Concurrency tags: - - Java - - Difficulty-Intermediate + - Performance --- ## Also known as @@ -27,5 +26,6 @@ This pattern can be used when data can be divided into multiple parts, all of wh In this pattern, parallel processing is performed using a system consisting of a master and some number of workers, where a master divides the work among the workers, gets the result back from them and assimilates all the results to give final result. The only communication is between the master and the worker - none of the workers communicate among one another and the user only communicates with the master to get the required job done. The master has to maintain a record of how the divided data has been distributed, how many workers have finished their work and returned a result, and the results themselves to be able to aggregate the data correctly. ## Credits + * [https://docs.gigaspaces.com/sbp/master-worker-pattern.html] * [http://www.cs.sjsu.edu/~pearce/oom/patterns/behavioral/masterslave.htm] diff --git a/mediator/README.md b/mediator/README.md index 4e38d833c..e8e0fa412 100644 --- a/mediator/README.md +++ b/mediator/README.md @@ -5,9 +5,8 @@ folder: mediator permalink: /patterns/mediator/ categories: Behavioral tags: - - Java - Gang Of Four - - Difficulty-Intermediate + - Decoupling --- ## Intent diff --git a/memento/README.md b/memento/README.md index 34555f550..a07009944 100644 --- a/memento/README.md +++ b/memento/README.md @@ -5,9 +5,7 @@ folder: memento permalink: /patterns/memento/ categories: Behavioral tags: - - Java - Gang Of Four - - Difficulty-Intermediate --- ## Also known as diff --git a/model-view-controller/README.md b/model-view-controller/README.md index acc3c07a9..c1542df04 100644 --- a/model-view-controller/README.md +++ b/model-view-controller/README.md @@ -3,10 +3,9 @@ layout: pattern title: Model-View-Controller folder: model-view-controller permalink: /patterns/model-view-controller/ -categories: Presentation Tier +categories: Architectural tags: - - Java - - Difficulty-Intermediate + - Decoupling --- ## Intent @@ -21,7 +20,7 @@ display. ## 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 ## Credits diff --git a/model-view-presenter/README.md b/model-view-presenter/README.md index ede8e3bae..e9cbe1e96 100644 --- a/model-view-presenter/README.md +++ b/model-view-presenter/README.md @@ -3,10 +3,9 @@ layout: pattern title: Model-View-Presenter folder: model-view-presenter permalink: /patterns/model-view-presenter/ -categories: Presentation Tier +categories: Architectural tags: - - Java - - Difficulty-Intermediate + - Decoupling --- ## Intent @@ -20,8 +19,8 @@ developers to build and test user interfaces. 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. +* When you want to improve the "Separation of Concerns" principle in presentation logic +* When a user interface development and testing is necessary. ## Real world examples diff --git a/module/README.md b/module/README.md index 316458e0b..32897adef 100644 --- a/module/README.md +++ b/module/README.md @@ -3,10 +3,9 @@ layout: pattern title: Module folder: module permalink: /patterns/module/ -categories: Creational Pattern +categories: Structural tags: - - Java - - Difficulty-Beginner + - Decoupling --- ## Intent diff --git a/monad/README.md b/monad/README.md index cf751929c..3da976d23 100644 --- a/monad/README.md +++ b/monad/README.md @@ -3,11 +3,9 @@ layout: pattern title: Monad folder: monad permalink: /patterns/monad/ -categories: Other +categories: Functional tags: - - Java - - Difficulty-Expert - - Functional + - Reactive --- ## Intent @@ -26,8 +24,8 @@ return - that takes plain type object and returns this object wrapped in a monad Use the Monad in any of the following situations -* when you want to chain operations easily -* when you want to apply each function regardless of the result of any of them +* When you want to chain operations easily +* When you want to apply each function regardless of the result of any of them ## Credits diff --git a/monostate/README.md b/monostate/README.md index 93cf6a45b..790fb1f6d 100644 --- a/monostate/README.md +++ b/monostate/README.md @@ -5,8 +5,7 @@ folder: monostate permalink: /patterns/monostate/ categories: Creational tags: - - Java - - Difficulty-Beginner + - Instantiation --- ## Also known as @@ -27,9 +26,9 @@ Use the Monostate pattern when ## Typical Use Case -* the logging class -* managing a connection to a database -* file manager +* The logging class +* Managing a connection to a database +* File manager ## Real world examples diff --git a/multiton/README.md b/multiton/README.md index 105dd9d91..4387cf7ac 100644 --- a/multiton/README.md +++ b/multiton/README.md @@ -5,8 +5,7 @@ folder: multiton permalink: /patterns/multiton/ categories: Creational tags: - - Java - - Difficulty-Beginner + - Instantiation --- ## Also known as diff --git a/mute-idiom/README.md b/mute-idiom/README.md index 7df0ae110..4d860dbef 100644 --- a/mute-idiom/README.md +++ b/mute-idiom/README.md @@ -3,11 +3,9 @@ layout: pattern title: Mute Idiom folder: mute-idiom permalink: /patterns/mute-idiom/ -categories: Other +categories: Idiom tags: - - Java - - Difficulty-Beginner - - Idiom + - Decoupling --- ## Intent diff --git a/mutex/README.md b/mutex/README.md index 14b465a60..43ed8d947 100644 --- a/mutex/README.md +++ b/mutex/README.md @@ -5,13 +5,13 @@ folder: mutex permalink: /patterns/mutex/ categories: Concurrency tags: - - Java - - Difficulty-Intermediate + - Decoupling --- ## Also known as -Mutual Exclusion Lock -Binary Semaphore + +* Mutual Exclusion Lock +* Binary Semaphore ## Intent Create a lock which only allows a single thread to access a resource at any one instant. @@ -22,8 +22,8 @@ Create a lock which only allows a single thread to access a resource at any one ## Applicability Use a Mutex when -* you need to prevent two threads accessing a critical section at the same time -* concurrent access to a resource could lead to a race condition +* You need to prevent two threads accessing a critical section at the same time +* Concurrent access to a resource could lead to a race condition ## Credits diff --git a/naked-objects/README.md b/naked-objects/README.md index 3d3cdaab9..bb38c81f2 100644 --- a/naked-objects/README.md +++ b/naked-objects/README.md @@ -5,8 +5,7 @@ folder: naked-objects permalink: /patterns/naked-objects/ categories: Architectural tags: - - Java - - Difficulty-Expert + - Decoupling --- ## Intent @@ -20,9 +19,9 @@ everything else is autogenerated by the framework. ## Applicability Use the Naked Objects pattern when -* you are prototyping and need fast development cycle -* an autogenerated user interface is good enough -* you want to automatically publish the domain as REST services +* You are prototyping and need fast development cycle +* An autogenerated user interface is good enough +* You want to automatically publish the domain as REST services ## Real world examples diff --git a/null-object/README.md b/null-object/README.md index 1be72a1b7..d0a6f530d 100644 --- a/null-object/README.md +++ b/null-object/README.md @@ -5,8 +5,7 @@ folder: null-object permalink: /patterns/null-object/ categories: Behavioral tags: - - Java - - Difficulty-Beginner + - Extensibility --- ## Intent @@ -25,7 +24,8 @@ 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. +* You want to avoid explicit null checks and keep the algorithm elegant and easy to read. ## Credits + * [Pattern Languages of Program Design](http://www.amazon.com/Pattern-Languages-Program-Design-Coplien/dp/0201607344/ref=sr_1_1) diff --git a/object-mother/README.md b/object-mother/README.md index bd4c14e1c..4c1a04ae2 100644 --- a/object-mother/README.md +++ b/object-mother/README.md @@ -5,8 +5,7 @@ folder: object-mother permalink: /patterns/object-mother/ categories: Creational tags: - - Java - - Difficulty-Beginner + - Instantiation --- ## Object Mother @@ -19,13 +18,11 @@ Define a factory of immutable content with separated builder and factory interfa Use the Object Mother pattern when * You want consistent objects over several tests -* you want to reduce code for creation of objects in tests -* every test should run with fresh data +* You want to reduce code for creation of objects in tests +* Every test should run with fresh data ## Credits * [Answer by David Brown](http://stackoverflow.com/questions/923319/what-is-an-objectmother) to the stackoverflow question: [What is an ObjectMother?](http://stackoverflow.com/questions/923319/what-is-an-objectmother) - * [c2wiki - Object Mother](http://c2.com/cgi/wiki?ObjectMother) - * [Nat Pryce - Test Data Builders: an alternative to the Object Mother pattern](http://www.natpryce.com/articles/000714.html) diff --git a/object-pool/README.md b/object-pool/README.md index f6b80539b..efbf692ae 100644 --- a/object-pool/README.md +++ b/object-pool/README.md @@ -5,8 +5,7 @@ folder: object-pool permalink: /patterns/object-pool/ categories: Creational tags: - - Java - - Difficulty-Beginner + - Game programming - Performance --- @@ -22,5 +21,5 @@ 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) +* The objects are expensive to create (allocation cost) +* You need a large number of short-lived objects (memory fragmentation) diff --git a/observer/README.md b/observer/README.md index 12a0a4677..7b31c7450 100644 --- a/observer/README.md +++ b/observer/README.md @@ -5,8 +5,6 @@ folder: observer permalink: /patterns/observer/ categories: Behavioral tags: - - Java - - Difficulty-Beginner - Gang Of Four - Reactive --- @@ -25,13 +23,13 @@ automatically. ## Applicability Use the Observer pattern in any of the following situations -* when an abstraction has two aspects, one dependent on the other. Encapsulating these aspects in separate objects lets you vary and reuse them independently -* when a change to one object requires changing others, and you don't know how many objects need to be changed -* when an object should be able to notify other objects without making assumptions about who these objects are. In other words, you don't want these objects tightly coupled +* When an abstraction has two aspects, one dependent on the other. Encapsulating these aspects in separate objects lets you vary and reuse them independently +* When a change to one object requires changing others, and you don't know how many objects need to be changed +* When an object should be able to notify other objects without making assumptions about who these objects are. In other words, you don't want these objects tightly coupled ## Typical Use Case -* changing in one object leads to a change in other objects +* Changing in one object leads to a change in other objects ## Real world examples diff --git a/page-object/README.md b/page-object/README.md index 13586e064..159cda6d1 100644 --- a/page-object/README.md +++ b/page-object/README.md @@ -3,10 +3,9 @@ layout: pattern title: Page Object folder: page-object permalink: /patterns/page-object/ -categories: Testing +categories: Structural tags: -- Java -- Difficulty-Intermediate +- Decoupling --- ## Intent diff --git a/partial-response/README.md b/partial-response/README.md index ebec3d97a..7894ca2ea 100644 --- a/partial-response/README.md +++ b/partial-response/README.md @@ -3,12 +3,9 @@ layout: pattern title: Partial Response folder: partial-response permalink: /patterns/partial-response/ -categories: Architectural +categories: Behavioral tags: - - Java - - KISS - - YAGNI - - Difficulty-Beginner + - Decoupling --- ## Intent diff --git a/pipeline/README.md b/pipeline/README.md index 2afa6da9a..bc8f9399a 100644 --- a/pipeline/README.md +++ b/pipeline/README.md @@ -5,9 +5,7 @@ folder: pipeline permalink: /patterns/pipeline/ categories: Behavioral tags: - - Java - - Functional - - Difficulty-Intermediate + - Decoupling --- ## Intent @@ -19,13 +17,13 @@ Allows processing of data in a series of stages by giving in an initial input an ## Applicability Use the Pipeline pattern when you want to -* execute individual stages that yields a final value -* add readability to complex sequence of operations by providing a fluent builder as an interface -* improve testability of code since stages will most likely be doing a single thing, complying to the [Single Responsibility Principle (SRP)](https://java-design-patterns.com/principles/#single-responsibility-principle) +* Execute individual stages that yields a final value +* Add readability to complex sequence of operations by providing a fluent builder as an interface +* Improve testability of code since stages will most likely be doing a single thing, complying to the [Single Responsibility Principle (SRP)](https://java-design-patterns.com/principles/#single-responsibility-principle) ## Typical Use Case -* implement stages and execute them in an ordered manner +* Implement stages and execute them in an ordered manner ## Real world examples diff --git a/poison-pill/README.md b/poison-pill/README.md index a4f842086..7fd152891 100644 --- a/poison-pill/README.md +++ b/poison-pill/README.md @@ -3,10 +3,9 @@ layout: pattern title: Poison Pill folder: poison-pill permalink: /patterns/poison-pill/ -categories: Other +categories: Behavioral tags: - - Java - - Difficulty-Intermediate + - Cloud distributed - Reactive --- @@ -20,7 +19,7 @@ graceful shutdown for separate distributed consumption process. ## Applicability Use the Poison Pill idiom when -* need to send signal from one thread/process to another to terminate +* Need to send signal from one thread/process to another to terminate ## Real world examples diff --git a/priority-queue/README.md b/priority-queue/README.md index 37a6e908d..c8d1f7773 100644 --- a/priority-queue/README.md +++ b/priority-queue/README.md @@ -5,8 +5,7 @@ folder: priority-queue permalink: /patterns/priority-queue/ categories: Behavioral tags: - - Java - - Difficulty-Beginner + - Decoupling --- ## Intent diff --git a/private-class-data/README.md b/private-class-data/README.md index 7937697c2..20e343285 100644 --- a/private-class-data/README.md +++ b/private-class-data/README.md @@ -3,11 +3,9 @@ layout: pattern title: Private Class Data folder: private-class-data permalink: /patterns/private-class-data/ -categories: Other +categories: Idiom tags: - - Java - - Difficulty-Beginner - - Idiom + - Data access --- ## Intent @@ -21,4 +19,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 +* You want to prevent write access to class data members diff --git a/producer-consumer/README.md b/producer-consumer/README.md index 12147af42..eb0275aaf 100644 --- a/producer-consumer/README.md +++ b/producer-consumer/README.md @@ -5,9 +5,6 @@ folder: producer-consumer permalink: /patterns/producer-consumer/ categories: Concurrency tags: - - Java - - Difficulty-Intermediate - - I/O - Reactive --- @@ -22,5 +19,5 @@ Producer Consumer Design pattern is a classic concurrency pattern which reduces ## Applicability Use the Producer Consumer idiom when -* decouple system by separate work in two process produce and consume. -* addresses the issue of different timing require to produce work or consuming work +* Decouple system by separate work in two process produce and consume. +* Addresses the issue of different timing require to produce work or consuming work diff --git a/promise/README.md b/promise/README.md index 3eb5efcb6..cf3d96c88 100644 --- a/promise/README.md +++ b/promise/README.md @@ -5,10 +5,7 @@ folder: promise permalink: /patterns/promise/ categories: Concurrency tags: - - Java - - Functional - Reactive - - Difficulty-Intermediate --- ## Also known as @@ -27,9 +24,9 @@ in a synchronous way. Promise pattern is applicable in concurrent programming when some work needs to be done asynchronously and: -* code maintainability and readability suffers due to callback hell. -* you need to compose promises and need better error handling for asynchronous tasks. -* you want to use functional style of programming. +* Code maintainability and readability suffers due to callback hell. +* You need to compose promises and need better error handling for asynchronous tasks. +* You want to use functional style of programming. ## Real world examples diff --git a/property/README.md b/property/README.md index 60d82434e..2eb684dd3 100644 --- a/property/README.md +++ b/property/README.md @@ -5,8 +5,7 @@ folder: property permalink: /patterns/property/ categories: Creational tags: - - Java - - Difficulty-Beginner + - Instantiation --- ## Intent @@ -19,7 +18,7 @@ objects as parents. ## Applicability Use the Property pattern when -* when you like to have objects with dynamic set of fields and prototype inheritance +* When you like to have objects with dynamic set of fields and prototype inheritance ## Real world examples diff --git a/prototype/README.md b/prototype/README.md index fe796183c..1cbe67244 100644 --- a/prototype/README.md +++ b/prototype/README.md @@ -5,9 +5,8 @@ folder: prototype permalink: /patterns/prototype/ categories: Creational tags: - - Java - Gang Of Four - - Difficulty-Beginner + - Instantiation --- ## Intent @@ -68,10 +67,10 @@ System.out.println(cloned.getName()); // Dolly ## Applicability Use the Prototype pattern when a system should be independent of how its products are created, composed and represented; and -* when the classes to instantiate are specified at run-time, for example, by dynamic loading -* to avoid building a class hierarchy of factories that parallels the class hierarchy of products -* when instances of a class can have one of only a few different combinations of state. It may be more convenient to install a corresponding number of prototypes and clone them rather than instantiating the class manually, each time with the appropriate state -* when object creation is expensive compared to cloning +* When the classes to instantiate are specified at run-time, for example, by dynamic loading +* To avoid building a class hierarchy of factories that parallels the class hierarchy of products +* When instances of a class can have one of only a few different combinations of state. It may be more convenient to install a corresponding number of prototypes and clone them rather than instantiating the class manually, each time with the appropriate state +* When object creation is expensive compared to cloning ## Real world examples diff --git a/proxy/README.md b/proxy/README.md index e94ebfbc6..b5fae677d 100644 --- a/proxy/README.md +++ b/proxy/README.md @@ -5,9 +5,8 @@ folder: proxy permalink: /patterns/proxy/ categories: Structural tags: - - Java - Gang Of Four - - Difficulty-Beginner + - Decoupling --- ## Also known as @@ -130,6 +129,7 @@ are several common situations in which the Proxy pattern is applicable * Count references to an object ## Tutorials + * [Controlling Access With Proxy Pattern](http://java-design-patterns.com/blog/controlling-access-with-proxy-pattern/) ## Real world examples diff --git a/queue-load-leveling/README.md b/queue-load-leveling/README.md index f965448b2..3674e7413 100644 --- a/queue-load-leveling/README.md +++ b/queue-load-leveling/README.md @@ -3,10 +3,9 @@ layout: pattern title: Queue based load leveling folder: queue-load-leveling permalink: /patterns/queue-load-leveling/ -categories: Other +categories: Concurrency tags: - - Java - - Difficulty-Intermediate + - Decoupling - Performance --- diff --git a/reactor/README.md b/reactor/README.md index e18595656..9e66708dd 100644 --- a/reactor/README.md +++ b/reactor/README.md @@ -6,9 +6,8 @@ permalink: /patterns/reactor/ pumlformat: svg categories: Concurrency tags: - - Java - - Difficulty-Expert - - I/O + - Performance + - Reactive --- ## Intent @@ -20,9 +19,9 @@ The Reactor design pattern handles service requests that are delivered concurren ## Applicability Use Reactor pattern when -* a server application needs to handle concurrent service requests from multiple clients. -* a server application needs to be available for receiving requests from new clients even when handling older client requests. -* a server must maximize throughput, minimize latency and use CPU efficiently without blocking. +* A server application needs to handle concurrent service requests from multiple clients. +* A server application needs to be available for receiving requests from new clients even when handling older client requests. +* A server must maximize throughput, minimize latency and use CPU efficiently without blocking. ## Real world examples diff --git a/reader-writer-lock/README.md b/reader-writer-lock/README.md index 30cbc0dc5..d5f1d9d12 100644 --- a/reader-writer-lock/README.md +++ b/reader-writer-lock/README.md @@ -5,9 +5,6 @@ folder: reader-writer-lock permalink: /patterns/reader-writer-lock/ categories: Concurrency tags: - - Java - - Difficulty-Intermediate - - I/O - Performance --- @@ -29,5 +26,4 @@ Application need to increase the performance of resource synchronize for multip ## Credits * [Readers–writer lock](https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock) - -* [Readers–writers_problem](https://en.wikipedia.org/wiki/Readers%E2%80%93writers_problem) \ No newline at end of file +* [Readers–writers_problem](https://en.wikipedia.org/wiki/Readers%E2%80%93writers_problem) diff --git a/repository/README.md b/repository/README.md index 400e37eb0..b500d2efd 100644 --- a/repository/README.md +++ b/repository/README.md @@ -3,11 +3,9 @@ layout: pattern title: Repository folder: repository permalink: /patterns/repository/ -categories: Persistence Tier +categories: Architectural tags: - - Java - - Difficulty-Intermediate - - Spring + - Data access --- ## Intent @@ -23,10 +21,10 @@ querying is utilized. ## Applicability Use the Repository pattern when -* the number of domain objects is large -* you want to avoid duplication of query code -* you want to keep the database querying code in single place -* you have multiple data sources +* The number of domain objects is large +* You want to avoid duplication of query code +* You want to keep the database querying code in single place +* You have multiple data sources ## Real world examples diff --git a/resource-acquisition-is-initialization/README.md b/resource-acquisition-is-initialization/README.md index 3591cf915..02b28c4a1 100644 --- a/resource-acquisition-is-initialization/README.md +++ b/resource-acquisition-is-initialization/README.md @@ -3,11 +3,9 @@ layout: pattern title: Resource Acquisition Is Initialization folder: resource-acquisition-is-initialization permalink: /patterns/resource-acquisition-is-initialization/ -categories: Other +categories: Idiom tags: - - Java - - Difficulty-Beginner - - Idiom + - Data access --- ## Intent @@ -19,4 +17,4 @@ Resource Acquisition Is Initialization pattern can be used to implement exceptio ## 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 diff --git a/retry/README.md b/retry/README.md index 59958403c..27325331d 100644 --- a/retry/README.md +++ b/retry/README.md @@ -3,10 +3,8 @@ layout: pattern title: Retry folder: retry permalink: /patterns/retry/ -categories: Other +categories: Behavioral tags: - - Java - - Difficulty-Expert - Performance --- @@ -151,4 +149,5 @@ You can view Microsoft's article [here](https://docs.microsoft.com/en-us/azure/a * Operations maintenance ## Related Patterns + * [Circuit Breaker](https://martinfowler.com/bliki/CircuitBreaker.html) diff --git a/role-object/README.md b/role-object/README.md index e5378afde..424c64cda 100644 --- a/role-object/README.md +++ b/role-object/README.md @@ -5,9 +5,7 @@ folder: role-object permalink: /patterns/role-object/ categories: Structural tags: - - Java - - Difficulty-Medium - - Handle Body Pattern + - Extensibility --- ## Also known as @@ -23,12 +21,14 @@ individual objects, different contexts are kept separate and system configuratio ## Applicability Use the Role Object pattern, if: -- you want to handle a key abstraction in different contexts and you do not want to put the resulting context specific interfaces into the same class interface. -- you want to handle the available roles dynamically so that they can be attached and removed on demand, that is at runtime, rather than fixing them statically at compile-time. -- you want to treat the extensions transparently and need to preserve the logical object identity of the resultingobject conglomerate. -- you want to keep role/client pairs independent from each other so that changes to a role do not affect clients that are not interested in that role. + +- You want to handle a key abstraction in different contexts and you do not want to put the resulting context specific interfaces into the same class interface. +- You want to handle the available roles dynamically so that they can be attached and removed on demand, that is at runtime, rather than fixing them statically at compile-time. +- You want to treat the extensions transparently and need to preserve the logical object identity of the resultingobject conglomerate. +- You want to keep role/client pairs independent from each other so that changes to a role do not affect clients that are not interested in that role. ## Credits + - [Hillside - Role object pattern](https://hillside.net/plop/plop97/Proceedings/riehle.pdf) - [Role object](http://wiki.c2.com/?RoleObject) -- [Fowler - Dealing with roles](https://martinfowler.com/apsupp/roles.pdf) \ No newline at end of file +- [Fowler - Dealing with roles](https://martinfowler.com/apsupp/roles.pdf) diff --git a/saga/README.md b/saga/README.md index bfb39461a..50aeb7d73 100644 --- a/saga/README.md +++ b/saga/README.md @@ -3,12 +3,9 @@ layout: pattern title: Saga folder: saga permalink: /patterns/saga/ -categories: Behavioral +categories: Concurrency tags: - - Java - - Difficulty-Expert - - Idiom - - Distributed communication + - Cloud distributed --- ## Also known as @@ -40,10 +37,12 @@ This orchestrator can also be though of as a Saga Manager. ## Applicability Use the Saga pattern, if: + - you need to perform a group of operations related to different microservices atomically - you need to rollback changes in different places in case of failure one of the operation - you need to take care of data consistency in different places including different databases - you can not use 2PC(two phase commit) ## Credits -- [Pattern: Saga](https://microservices.io/patterns/data/saga.html) \ No newline at end of file + +- [Pattern: Saga](https://microservices.io/patterns/data/saga.html) diff --git a/semaphore/README.md b/semaphore/README.md index a59d7b398..be882e04a 100644 --- a/semaphore/README.md +++ b/semaphore/README.md @@ -5,8 +5,7 @@ folder: semaphore permalink: /patterns/semaphore/ categories: Concurrency tags: - - Java - - Difficulty-Intermediate + - Performance --- ## Also known as @@ -25,8 +24,8 @@ is called a binary semaphore. ## Applicability Use a Semaphore when -* you have a pool of resources to allocate to different threads -* concurrent access to a resource could lead to a race condition +* You have a pool of resources to allocate to different threads +* Concurrent access to a resource could lead to a race condition ## Credits diff --git a/servant/README.md b/servant/README.md index 67470b678..85ad6872d 100644 --- a/servant/README.md +++ b/servant/README.md @@ -3,10 +3,9 @@ layout: pattern title: Servant folder: servant permalink: /patterns/servant/ -categories: Structural +categories: Behavioral tags: - - Java - - Difficulty-Beginner + - Decoupling --- ## Intent @@ -20,7 +19,8 @@ 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. +* When we want some objects to perform a common action and don't want to define this action as a method in every class. ## Credits + * [Let's Modify the Objects-First Approach into Design-Patterns-First](http://edu.pecinovsky.cz/papers/2006_ITiCSE_Design_Patterns_First.pdf) diff --git a/serverless/README.md b/serverless/README.md index 46e646f06..c33c034e6 100644 --- a/serverless/README.md +++ b/serverless/README.md @@ -5,8 +5,7 @@ folder: serverless permalink: /patterns/serverless/ categories: Architectural tags: - - Java - - Difficulty-Intermediate + - Cloud distributed --- ## Serverless @@ -126,6 +125,7 @@ dependencies of the function. ## Run example in local # Pre-requisites + * Node.js v6.5.0 or later. * Serverless CLI v1.9.0 or later. You can run npm install -g serverless to install it. * An AWS account. If you don't already have one, you can sign up for a free trial that includes 1 million free Lambda requests per month. @@ -139,6 +139,7 @@ dependencies of the function. Based on the configuration in `serverless.yml` serverless framework creates following resources + * CloudFormation stack for S3 (ServerlessDeploymentBucket) * IAM Role (IamRoleLambdaExecution) * CloudWatch (log groups) @@ -199,4 +200,4 @@ curl -X GET \ * [serverless docs](https://serverless.com/framework/docs/) * [Serverless Architectures](https://martinfowler.com/articles/serverless.html) -* [Serverless Black Belt](https://youtu.be/oQFORsso2go) \ No newline at end of file +* [Serverless Black Belt](https://youtu.be/oQFORsso2go) diff --git a/service-layer/README.md b/service-layer/README.md index 9abb6294a..b2b61a17a 100644 --- a/service-layer/README.md +++ b/service-layer/README.md @@ -5,8 +5,7 @@ folder: service-layer permalink: /patterns/service-layer/ categories: Architectural tags: - - Java - - Difficulty-Intermediate + - Data access --- ## Intent @@ -23,8 +22,8 @@ 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 +* You want to encapsulate domain logic under API +* You need to implement multiple interfaces with common logic and data ## Credits diff --git a/service-locator/README.md b/service-locator/README.md index 0be75f117..16c10f4de 100644 --- a/service-locator/README.md +++ b/service-locator/README.md @@ -3,10 +3,9 @@ layout: pattern title: Service Locator folder: service-locator permalink: /patterns/service-locator/ -categories: Structural +categories: Architectural tags: - - Java - - Difficulty-Beginner + - Game programming - Performance --- @@ -29,9 +28,9 @@ improves the performance of application to great extent. ## Typical Use Case -* when network hits are expensive and time consuming -* lookups of services are done quite frequently -* large number of services are being used +* When network hits are expensive and time consuming +* Lookups of services are done quite frequently +* Large number of services are being used ## Consequences diff --git a/sharding/README.md b/sharding/README.md index aeeb71828..2ee465401 100644 --- a/sharding/README.md +++ b/sharding/README.md @@ -3,10 +3,10 @@ layout: pattern title: Sharding folder: sharding permalink: /patterns/sharding/ -categories: Other +categories: Behavioral tags: - - Java - - Difficulty-Beginner + - Performance + - Cloud distributed --- ## Intent diff --git a/singleton/README.md b/singleton/README.md index d82f7d862..6d9cfcd82 100644 --- a/singleton/README.md +++ b/singleton/README.md @@ -5,9 +5,7 @@ folder: singleton permalink: /patterns/singleton/ categories: Creational tags: - - Java - Gang Of Four - - Difficulty-Beginner --- ## Intent @@ -54,14 +52,14 @@ assertEquals(enumIvoryTower1, enumIvoryTower2); // true ## Applicability Use the Singleton pattern when -* there must be exactly one instance of a class, and it must be accessible to clients from a well-known access point -* when the sole instance should be extensible by subclassing, and clients should be able to use an extended instance without modifying their code +* There must be exactly one instance of a class, and it must be accessible to clients from a well-known access point +* When the sole instance should be extensible by subclassing, and clients should be able to use an extended instance without modifying their code ## Typical Use Case -* the logging class -* managing a connection to a database -* file manager +* The logging class +* Managing a connection to a database +* File manager ## Real world examples diff --git a/spatial-partition/README.md b/spatial-partition/README.md index 5206708bc..8484de876 100644 --- a/spatial-partition/README.md +++ b/spatial-partition/README.md @@ -3,10 +3,10 @@ layout: pattern title: Spatial Partition folder: spatial-partition permalink: /patterns/spatial-partition/ -categories: Other +categories: Behavioral tags: - - Java - - Difficulty-Intermediate + - Performance + - Game programming --- ## Intent @@ -48,9 +48,11 @@ In our implementation, we use the Quadtree data structure which will reduce the ## Applicability This pattern can be used: + * When you need to keep track of a large number of objects' positions, which are getting updated every frame. * When it is acceptable to trade memory for speed, since creating and updating data structure will use up extra memory. ## Credits + * [Game Programming Patterns/Spatial Partition](http://gameprogrammingpatterns.com/spatial-partition.html) by Bob Nystrom * [Quadtree tutorial](https://www.youtube.com/watch?v=OJxEcs0w_kE) by Daniel Schiffman diff --git a/specification/README.md b/specification/README.md index 8c32a7875..d5e7edf20 100644 --- a/specification/README.md +++ b/specification/README.md @@ -5,9 +5,7 @@ folder: specification permalink: /patterns/specification/ categories: Behavioral tags: - - Java - - Difficulty-Beginner - - Searching + - Data access --- ## Also known as diff --git a/state/README.md b/state/README.md index 726d842ae..9519a2154 100644 --- a/state/README.md +++ b/state/README.md @@ -5,8 +5,6 @@ folder: state permalink: /patterns/state/ categories: Behavioral tags: - - Java - - Difficulty-Intermediate - Gang Of Four --- @@ -23,8 +21,8 @@ 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. +* 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. ## Real world examples diff --git a/step-builder/README.md b/step-builder/README.md index b4394496d..3fdbf49f4 100644 --- a/step-builder/README.md +++ b/step-builder/README.md @@ -5,8 +5,7 @@ folder: step-builder permalink: /patterns/step-builder/ categories: Creational tags: - - Java - - Difficulty-Intermediate + - Instantiation --- ## Intent diff --git a/strategy/README.md b/strategy/README.md index b6f41c027..89cdb4dd3 100644 --- a/strategy/README.md +++ b/strategy/README.md @@ -5,8 +5,6 @@ folder: strategy permalink: /patterns/strategy/ categories: Behavioral tags: - - Java - - Difficulty-Beginner - Gang Of Four --- @@ -24,12 +22,13 @@ that use it. ## Applicability Use the Strategy pattern when -* 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 +* 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 ## Tutorial + * [Strategy Pattern Tutorial](https://www.journaldev.com/1754/strategy-design-pattern-in-java-example-tutorial) ## Credits diff --git a/subclass-sandbox/README.md b/subclass-sandbox/README.md index 8fb034279..311166d12 100644 --- a/subclass-sandbox/README.md +++ b/subclass-sandbox/README.md @@ -3,10 +3,9 @@ layout: pattern title: Subclass Sandbox folder: subclass-sandbox permalink: /patterns/subclass-sandbox/ -categories: Other +categories: Behavioral tags: - - Java - - Difficulty-Beginner + - Game programming --- ## Intent @@ -19,13 +18,10 @@ The subclass sandbox pattern describes a basic idea, while not having a lot of d The Subclass Sandbox pattern is a very simple, common pattern lurking in lots of codebases, even outside of games. If you have a non-virtual protected method laying around, you’re probably already using something like this. Subclass Sandbox is a good fit when: - You have a base class with a number of derived classes. - - The base class is able to provide all of the operations that a derived class may need to perform. - - There is behavioral overlap in the subclasses and you want to make it easier to share code between them. - - You want to minimize coupling between those derived classes and the rest of the program. ## Credits -* [Game Programming Patterns - Subclass Sandbox]([http://gameprogrammingpatterns.com/subclass-sandbox.html](http://gameprogrammingpatterns.com/subclass-sandbox.html)) \ No newline at end of file +* [Game Programming Patterns - Subclass Sandbox]([http://gameprogrammingpatterns.com/subclass-sandbox.html](http://gameprogrammingpatterns.com/subclass-sandbox.html)) diff --git a/template-method/README.md b/template-method/README.md index b1ad04fb6..43726fda5 100644 --- a/template-method/README.md +++ b/template-method/README.md @@ -5,8 +5,6 @@ folder: template-method permalink: /patterns/template-method/ categories: Behavioral tags: - - Java - - Difficulty-Beginner - Gang Of Four --- @@ -22,17 +20,21 @@ To make sure that subclasses don’t override the template method, the template ## Applicability The Template Method pattern should be used -* 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 + +* 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 ## Tutorial + * [Template-method Pattern Tutorial](https://www.journaldev.com/1763/template-method-design-pattern-in-java) ## Real world examples + * [javax.servlet.GenericServlet.init](https://jakarta.ee/specifications/servlet/4.0/apidocs/javax/servlet/GenericServlet.html#init--): Method `GenericServlet.init(ServletConfig config)` calls the parameterless method `GenericServlet.init()` which is intended to be overridden in subclasses. Method `GenericServlet.init(ServletConfig config)` is the template method in this example. ## Credits + * [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612) diff --git a/thread-pool/README.md b/thread-pool/README.md index 445fba07b..0e125176d 100644 --- a/thread-pool/README.md +++ b/thread-pool/README.md @@ -5,8 +5,6 @@ folder: thread-pool permalink: /patterns/thread-pool/ categories: Concurrency tags: - - Java - - Difficulty-Intermediate - Performance --- @@ -23,4 +21,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 +* You have a large number of short-lived tasks to be executed in parallel diff --git a/throttling/README.md b/throttling/README.md index ad0361f39..12090c5e3 100644 --- a/throttling/README.md +++ b/throttling/README.md @@ -5,8 +5,7 @@ folder: throttling permalink: /patterns/throttling/ categories: Behavioral tags: - - Java - - Difficulty-Beginner + - Performance --- ## Intent @@ -18,5 +17,5 @@ Ensure that a given client is not able to access service resources more than the ## Applicability The Throttling pattern should be used: -* when a service access needs to be restricted to not have high impacts on the performance of the service. -* when multiple clients are consuming the same service resources and restriction has to be made according to the usage per client. +* When a service access needs to be restricted to not have high impacts on the performance of the service. +* When multiple clients are consuming the same service resources and restriction has to be made according to the usage per client. diff --git a/tls/README.md b/tls/README.md index ac4aa2490..3700795a0 100644 --- a/tls/README.md +++ b/tls/README.md @@ -3,11 +3,9 @@ layout: pattern title: Thread Local Storage folder: tls permalink: /patterns/tls/ -pumlid: -categories: Concurrency +categories: Idiom tags: - - Java - - Difficulty-Intermediate + - Performance --- ## Intent @@ -19,5 +17,5 @@ Securing variables global to a thread against being spoiled by other threads. Th ## Applicability Use the Thread Local Storage in any of the following situations -* when you use class variables in your Callable / Runnable object that are not read-only and you use the same Callable instance in more than one thread running in parallel. -* when you use static variables in your Callable / Runnable object that are not read-only and more than one instances of the Callable / Runnable may run in parallel threads. +* When you use class variables in your Callable / Runnable object that are not read-only and you use the same Callable instance in more than one thread running in parallel. +* When you use static variables in your Callable / Runnable object that are not read-only and more than one instances of the Callable / Runnable may run in parallel threads. diff --git a/tolerant-reader/README.md b/tolerant-reader/README.md index 5ba0fd09f..c60e75707 100644 --- a/tolerant-reader/README.md +++ b/tolerant-reader/README.md @@ -5,8 +5,7 @@ folder: tolerant-reader permalink: /patterns/tolerant-reader/ categories: Integration tags: - - Java - - Difficulty-Beginner + - Decoupling --- ## Intent @@ -21,7 +20,7 @@ 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 +* The communication schema can evolve and change and yet the receiving side should not break ## Credits diff --git a/trampoline/README.md b/trampoline/README.md index 77b4daa7b..2356e8715 100644 --- a/trampoline/README.md +++ b/trampoline/README.md @@ -5,10 +5,7 @@ folder: trampoline permalink: /patterns/trampoline/ categories: Behavioral tags: - - Java - - Difficulty-Intermediate - Performance - - Recursion --- ## Intent @@ -31,14 +28,17 @@ Use the Trampoline pattern when * For interleaving the execution of two or more functions on the same thread. ## Known uses(real world examples) + * Trampoline refers to using reflection to avoid using inner classes, for example in event listeners. The time overhead of a reflection call is traded for the space overhead of an inner class. Trampolines in Java usually involve the creation of a GenericListener to pass events to an outer class. ## Tutorials + * [Trampolining: a practical guide for awesome Java Developers](https://medium.com/@johnmcclean/trampolining-a-practical-guide-for-awesome-java-developers-4b657d9c3076) * [Trampoline in java ](http://mindprod.com/jgloss/trampoline.html) ## Credits + * [library 'cyclops-react' uses the pattern](https://github.com/aol/cyclops-react) diff --git a/twin/README.md b/twin/README.md index cc7198ff4..ed7076892 100644 --- a/twin/README.md +++ b/twin/README.md @@ -3,14 +3,13 @@ layout: pattern title: Twin folder: twin permalink: /patterns/twin/ -categories: Creational +categories: Structural tags: - - Java - - Difficulty-Intermediate + - Extensibility --- ## Intent - Twin pattern is a design pattern which provides a standard solution to simulate multiple +Twin pattern is a design pattern which provides a standard solution to simulate multiple inheritance in java ## Class diagram @@ -19,8 +18,8 @@ inheritance in java ## Applicability Use the Twin idiom when -* to simulate multiple inheritance in a language that does not support this feature. -* to avoid certain problems of multiple inheritance such as name clashes. +* To simulate multiple inheritance in a language that does not support this feature. +* To avoid certain problems of multiple inheritance such as name clashes. ## Credits diff --git a/typeobjectpattern/README.md b/typeobjectpattern/README.md index 4cc49e9b7..a5a193c54 100644 --- a/typeobjectpattern/README.md +++ b/typeobjectpattern/README.md @@ -3,10 +3,10 @@ layout: pattern title: Type-Object folder: typeobjectpattern permalink: /patterns/typeobjectpattern/ -categories: Game Programming Patterns/Behavioral Patterns +categories: Behavioral tags: - - Java - - Difficulty-Beginner + - Game programming + - Extensibility --- ## Intent @@ -23,10 +23,12 @@ Using the type-object pattern, instead of creating many classes inheriting from ## Applicability This pattern can be used when: + * We don’t know what types we will need up front. * We want to be able to modify or add new types without having to recompile or change code. * Only difference between the different 'types' of objects is the data, not the behaviour. ## Credits + * [Game Programming Patterns/Type Object](http://gameprogrammingpatterns.com/type-object.html) by Robert Nystrom * [http://www.cs.sjsu.edu/~pearce/modules/patterns/analysis/top.htm] diff --git a/unit-of-work/README.md b/unit-of-work/README.md index a7c911220..21f653b7d 100644 --- a/unit-of-work/README.md +++ b/unit-of-work/README.md @@ -6,10 +6,7 @@ permalink: /patterns/unit-of-work/ categories: Architectural tags: - - Java - - KISS - - YAGNI - - Difficulty-Beginner + - Data access --- ## Intent diff --git a/update-method/README.md b/update-method/README.md index 73c5fe358..1404f2c52 100644 --- a/update-method/README.md +++ b/update-method/README.md @@ -3,10 +3,9 @@ layout: pattern title: Update Method folder: update-method permalink: /patterns/update-method/ -categories: Other +categories: Behavioral tags: - - Java - - Difficulty-Beginner + - Game programming --- ## Intent @@ -28,9 +27,7 @@ However, if the game is more abstract and the moving pieces are less like living Update methods work well when: - Your game has a number of objects or systems that need to run simultaneously. - - Each object’s behavior is mostly independent of the others. - - The objects need to be simulated over time. ## Credits diff --git a/value-object/README.md b/value-object/README.md index 4fa384037..ee6d7143b 100644 --- a/value-object/README.md +++ b/value-object/README.md @@ -5,8 +5,7 @@ folder: value-object permalink: /patterns/value-object/ categories: Creational tags: - - Java - - Difficulty-Beginner + - Instantiation --- ## Intent @@ -20,7 +19,7 @@ equal when they have the same value, not necessarily being the same object. ## Applicability Use the Value Object when -* you need to measure the objects' equality based on the objects' value +* You need to measure the objects' equality based on the objects' value ## Real world examples diff --git a/visitor/README.md b/visitor/README.md index f7a1dc17a..978b49c9e 100644 --- a/visitor/README.md +++ b/visitor/README.md @@ -5,8 +5,6 @@ folder: visitor permalink: /patterns/visitor/ categories: Behavioral tags: - - Java - - Difficulty-Intermediate - Gang Of Four --- @@ -21,9 +19,9 @@ of the elements on which it operates. ## Applicability Use the Visitor pattern when -* an object structure contains many classes of objects with differing interfaces, and you want to perform operations on these objects that depend on their concrete classes -* many distinct and unrelated operations need to be performed on objects in an object structure, and you want to avoid "polluting" their classes with these operations. Visitor lets you keep related operations together by defining them in one class. When the object structure is shared by many applications, use Visitor to put operations in just those applications that need them -* the classes defining the object structure rarely change, but you often want to define new operations over the structure. Changing the object structure classes requires redefining the interface to all visitors, which is potentially costly. If the object structure classes change often, then it's probably better to define the operations in those classes +* An object structure contains many classes of objects with differing interfaces, and you want to perform operations on these objects that depend on their concrete classes +* Many distinct and unrelated operations need to be performed on objects in an object structure, and you want to avoid "polluting" their classes with these operations. Visitor lets you keep related operations together by defining them in one class. When the object structure is shared by many applications, use Visitor to put operations in just those applications that need them +* The classes defining the object structure rarely change, but you often want to define new operations over the structure. Changing the object structure classes requires redefining the interface to all visitors, which is potentially costly. If the object structure classes change often, then it's probably better to define the operations in those classes ## Real world examples