Skip to content

Commit fcccc71

Browse files
committed
Added Double Dispatch pattern to README.md.
1 parent 5f7498a commit fcccc71

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ A programming idiom is a means of expressing a recurring construct in one or mor
9494
* [Poison Pill](#poison-pill)
9595
* [Callback](#callback)
9696
* [Lazy Loading](#lazy-loading)
97+
* [Double Dispatch](#double-dispatch)
9798

9899
## <a name="abstract-factory">Abstract Factory</a> [&#8593;](#list-of-design-patterns)
99100
**Intent:** Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
@@ -569,6 +570,17 @@ validation and for building to order
569570
**Applicability:** Use the Flux pattern when
570571
* You want to focus on creating explicit and understandable update paths for your application's data, which makes tracing changes during development simpler and makes bugs easier to track down and fix.
571572

573+
## <a name="double-dispatch">Double Dispatch</a> [&#8593;](#list-of-design-patterns)
574+
**Intent:** Double Dispatch pattern is a way to create maintainable dynamic behavior based on receiver and parameter types.
575+
576+
![alt text](https://github.com/iluwatar/java-design-patterns/blob/master/double-dispatch/etc/double-dispatch.png "Double Dispatch")
577+
578+
**Applicability:** Use the Double Dispatch pattern when
579+
* The dynamic behavior is not defined only based on receiving object's type but also on the receiving method's parameter type.
580+
581+
**Real world examples:**
582+
* [ObjectOutputStream](https://docs.oracle.com/javase/8/docs/api/java/io/ObjectOutputStream.html)
583+
572584

573585

574586
# Frequently asked questions

0 commit comments

Comments
 (0)