This commit is contained in:
Ilkka Seppälä 2019-12-13 21:09:28 +02:00
parent 0335c61512
commit b2b1ba95eb
127 changed files with 282 additions and 450 deletions

View File

@ -5,8 +5,7 @@ folder: abstract-document
permalink: /patterns/abstract-document/
categories: Structural
tags:
- Java
- Difficulty-Intermediate
- Extensibility
---
## Intent

View File

@ -5,9 +5,7 @@ folder: abstract-factory
permalink: /patterns/abstract-factory/
categories: Creational
tags:
- Java
- Gang Of Four
- Difficulty-Intermediate
---
## Also known as

View File

@ -5,8 +5,7 @@ folder: acyclic-visitor
permalink: /patterns/acyclic-visitor/
categories: Behavioral
tags:
- Java
- Difficulty-Intermediate
- Extensibility
---
## Intent

View File

@ -5,9 +5,7 @@ folder: adapter
permalink: /patterns/adapter/
categories: Structural
tags:
- Java
- Gang Of Four
- Difficulty-Beginner
---
## Also known as

View File

@ -5,8 +5,7 @@ folder: aggregator-microservices
permalink: /patterns/aggregator-microservices/
categories: Architectural
tags:
- Java
- Spring
- Cloud distributed
---
## Intent

View File

@ -5,8 +5,7 @@ folder: ambassador
permalink: /patterns/ambassador/
categories: Structural
tags:
- Java
- Difficulty-Intermediate
- Decoupling
---
## Intent

View File

@ -5,9 +5,8 @@ folder: api-gateway
permalink: /patterns/api-gateway/
categories: Architectural
tags:
- Java
- Difficulty-Intermediate
- Spring
- Cloud distributed
- Decoupling
---
## Intent

View File

@ -5,9 +5,6 @@ folder: async-method-invocation
permalink: /patterns/async-method-invocation/
categories: Concurrency
tags:
- Java
- Difficulty-Intermediate
- Functional
- Reactive
---

View File

@ -5,8 +5,7 @@ folder: balking
permalink: /patterns/balking/
categories: Concurrency
tags:
- Java
- Difficulty-Beginner
- Decoupling
---
## Intent

View File

@ -5,9 +5,7 @@ folder: bridge
permalink: /patterns/bridge/
categories: Structural
tags:
- Java
- Gang Of Four
- Difficulty-Intermediate
---
## Also known as

View File

@ -5,9 +5,7 @@ folder: builder
permalink: /patterns/builder/
categories: Creational
tags:
- Java
- Gang Of Four
- Difficulty-Intermediate
---
## Intent

View File

@ -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

View File

@ -5,8 +5,7 @@ folder: bytecode
permalink: /patterns/bytecode/
categories: Behavioral
tags:
- Java
- Difficulty-Beginner
- Game programming
---
## Intent

View File

@ -3,10 +3,8 @@ layout: pattern
title: Caching
folder: caching
permalink: /patterns/caching/
categories: Other
categories: Behavioral
tags:
- Java
- Difficulty-Intermediate
- Performance
---

View File

@ -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

View File

@ -5,9 +5,7 @@ folder: chain
permalink: /patterns/chain/
categories: Behavioral
tags:
- Java
- Gang Of Four
- Difficulty-Intermediate
---
## Intent

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -5,10 +5,7 @@ folder: command
permalink: /patterns/command/
categories: Behavioral
tags:
- Java
- Gang Of Four
- Difficulty-Intermediate
- Functional
---
## Also known as

View File

@ -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/]

View File

@ -5,9 +5,7 @@ folder: composite
permalink: /patterns/composite/
categories: Structural
tags:
- Java
- Gang Of Four
- Difficulty-Intermediate
---
## Intent

View File

@ -3,10 +3,9 @@ layout: pattern
title: Converter
folder: converter
permalink: /patterns/converter/
categories: Business Tier
categories: Creational
tags:
- Java
- Difficulty-Beginner
- Decoupling
---
## Intent

View File

@ -5,8 +5,8 @@ folder: cqrs
permalink: /patterns/cqrs/
categories: Architectural
tags:
- Java
- Difficulty-Intermediate
- Performance
- Cloud distributed
---
## Intent

View File

@ -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

View File

@ -6,8 +6,7 @@ permalink: /patterns/data-bus/
categories: Architectural
tags:
- Java
- Difficulty-Intermediate
- Decoupling
---
## Intent

View File

@ -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
---

View File

@ -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

View File

@ -5,10 +5,7 @@ folder: data-transfer-object
permalink: /patterns/data-transfer-object/
categories: Architectural
tags:
- Java
- KISS
- YAGNI
- Difficulty-Beginner
- Performance
---
## Intent

View File

@ -5,9 +5,8 @@ folder: decorator
permalink: /patterns/decorator/
categories: Structural
tags:
- Java
- Gang Of Four
- Difficulty-Beginner
- Extensibility
---
## Also known as

View File

@ -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

View File

@ -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

View File

@ -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
---

View File

@ -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 youll 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, “youll know when you need it” doesnt 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 thats accessing the state from seeing the work in progress.
- We want to be able to read the state and we dont want to have to wait while its being written.
## Credits

View File

@ -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

View File

@ -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

View File

@ -5,9 +5,7 @@ folder: eip-aggregator
permalink: /patterns/eip-aggregator/
categories: Integration
tags:
- Java
- Difficulty-Intermittent
- EIP
- Enterprise Integration Pattern
---
## Intent

View File

@ -5,9 +5,7 @@ folder: eip-message-channel
permalink: /patterns/eip-message-channel/
categories: Integration
tags:
- Java
- EIP
- Apache Camel™
- Enterprise Integration Pattern
---
## Intent

View File

@ -5,9 +5,7 @@ folder: eip-publish-subscribe
permalink: /patterns/eip-publish-subscribe/
categories: Integration
tags:
- Java
- EIP
- Apache Camel™
- Enterprise Integration Pattern
---
## Intent

View File

@ -5,9 +5,7 @@ folder: eip-splitter
permalink: /patterns/eip-splitter/
categories: Integration
tags:
- Java
- Difficulty-Intermittent
- EIP
- Enterprise Integration Pattern
---
## Intent

View File

@ -5,9 +5,7 @@ folder: eip-wire-tap
permalink: /patterns/eip-wire-tap/
categories: Integration
tags:
- Java
- Difficulty-Intermittent
- EIP
- Enterprise Integration Pattern
---
## Intent

View File

@ -5,8 +5,6 @@ folder: event-aggregator
permalink: /patterns/event-aggregator/
categories: Structural
tags:
- Java
- Difficulty-Beginner
- Reactive
---

View File

@ -5,9 +5,7 @@ folder: event-asynchronous
permalink: /patterns/event-asynchronous/
categories: Concurrency
tags:
- difficulty-intermediate
- performance
- Java
- Reactive
---
## Intent

View File

@ -5,8 +5,6 @@ folder: event-driven-architecture
permalink: /patterns/event-driven-architecture/
categories: Architectural
tags:
- Java
- Difficulty-Intermediate
- Reactive
---

View File

@ -5,9 +5,7 @@ folder: event-queue
permalink: /patterns/event-queue/
categories: Concurrency
tags:
- Java
- Difficulty Intermediate
- Queue
- Game programming
---
## Intent

View File

@ -5,8 +5,6 @@ folder: event-sourcing
permalink: /patterns/event-sourcing/
categories: Architectural
tags:
- Java
- Difficulty Intermediate
- Performance
---

View File

@ -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)

View File

@ -5,8 +5,7 @@ folder: extension-objects
permalink: /patterns/extension-objects/
categories: Behavioral
tags:
- Java
- Difficulty-Intermediate
- Extensibility
---
## Intent

View File

@ -5,9 +5,8 @@ folder: facade
permalink: /patterns/facade/
categories: Structural
tags:
- Java
- Gang Of Four
- Difficulty-Beginner
- Decoupling
---
## Intent

View File

@ -5,9 +5,7 @@ folder: factory-kit
permalink: /patterns/factory-kit/
categories: Creational
tags:
- Java
- Difficulty-Beginner
- Functional
- Extensibility
---
## Intent

View File

@ -5,8 +5,7 @@ folder: factory-method
permalink: /patterns/factory-method/
categories: Creational
tags:
- Java
- Difficulty-Beginner
- Extensibility
- Gang Of Four
---

View File

@ -5,8 +5,7 @@ folder: feature-toggle
permalink: /patterns/feature-toggle/
categories: Behavioral
tags:
- Java
- Difficulty-Beginner
- Extensibility
---
## Also known as

View File

@ -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

View File

@ -3,10 +3,9 @@ layout: pattern
title: Flux
folder: flux
permalink: /patterns/flux/
categories: Presentation Tier
categories: Structural
tags:
- Java
- Difficulty-Intermediate
- Decoupling
---
## Intent

View File

@ -5,9 +5,7 @@ folder: flyweight
permalink: /patterns/flyweight/
categories: Structural
tags:
- Java
- Gang Of Four
- Difficulty-Intermediate
- Performance
---

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -5,8 +5,7 @@ folder: half-sync-half-async
permalink: /patterns/half-sync-half-async/
categories: Concurrency
tags:
- Java
- Difficulty-Intermediate
- Performance
---
## Intent

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -5,8 +5,6 @@ folder: iterator
permalink: /patterns/iterator/
categories: Behavioral
tags:
- Java
- Difficulty-Beginner
- Gang Of Four
---

View File

@ -6,9 +6,7 @@ permalink: /patterns/layers/
pumlformat: svg
categories: Architectural
tags:
- Java
- Difficulty-Intermediate
- Spring
- Decoupling
---
## Intent

View File

@ -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
---

View File

@ -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

View File

@ -3,10 +3,9 @@ layout: pattern
title: Marker Interface
folder: marker
permalink: /patterns/marker/
categories: Other
categories: Structural
tags:
- Java
- Difficulty-Beginner
- Decoupling
---
## Intent

View File

@ -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]

View File

@ -5,9 +5,8 @@ folder: mediator
permalink: /patterns/mediator/
categories: Behavioral
tags:
- Java
- Gang Of Four
- Difficulty-Intermediate
- Decoupling
---
## Intent

View File

@ -5,9 +5,7 @@ folder: memento
permalink: /patterns/memento/
categories: Behavioral
tags:
- Java
- Gang Of Four
- Difficulty-Intermediate
---
## Also known as

View File

@ -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

View File

@ -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

View File

@ -3,10 +3,9 @@ layout: pattern
title: Module
folder: module
permalink: /patterns/module/
categories: Creational Pattern
categories: Structural
tags:
- Java
- Difficulty-Beginner
- Decoupling
---
## Intent

View File

@ -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

View File

@ -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

View File

@ -5,8 +5,7 @@ folder: multiton
permalink: /patterns/multiton/
categories: Creational
tags:
- Java
- Difficulty-Beginner
- Instantiation
---
## Also known as

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -5,8 +5,7 @@ folder: priority-queue
permalink: /patterns/priority-queue/
categories: Behavioral
tags:
- Java
- Difficulty-Beginner
- Decoupling
---
## Intent

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
---

View File

@ -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

View File

@ -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
* [Readerswriter lock](https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock)
* [Readerswriters_problem](https://en.wikipedia.org/wiki/Readers%E2%80%93writers_problem)

View File

@ -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

View File

@ -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

View File

@ -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)

Some files were not shown because too many files have changed in this diff Show More