mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-13 22:16:03 +00:00
docs: updated diagrams for tolerant reader and trampoline
This commit is contained in:
1 parent
95bfd6cb4d
commit
21914f9c88
4 files changed
+8
No files matched your search
@@ -33,6 +33,10 @@ In plain words
|
|||||||
|
|
||||||
> Be conservative in what you do, be liberal in what you accept from others.
|
> Be conservative in what you do, be liberal in what you accept from others.
|
||||||
|
|
||||||
|
Sequence diagram
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## Programmatic Example of Tolerant Reader Pattern in Java
|
## Programmatic Example of Tolerant Reader Pattern in Java
|
||||||
|
|
||||||
We are persisting `RainbowFish` objects to file. Later on they need to be restored. What makes it problematic is that `RainbowFish` data structure is versioned and evolves over time. New version of `RainbowFish` needs to be able to restore old versions as well.
|
We are persisting `RainbowFish` objects to file. Later on they need to be restored. What makes it problematic is that `RainbowFish` data structure is versioned and evolves over time. New version of `RainbowFish` needs to be able to restore old versions as well.
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
@@ -36,6 +36,10 @@ Wikipedia says
|
|||||||
|
|
||||||
> In Java, 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.
|
> In Java, 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.
|
||||||
|
|
||||||
|
Flowchart
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## Programmatic Example of Trampoline Pattern in Java
|
## Programmatic Example of Trampoline Pattern in Java
|
||||||
|
|
||||||
Here's the `Trampoline` implementation in Java.
|
Here's the `Trampoline` implementation in Java.
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
Reference in new issue
Block a user