Skip to content

Commit 72c9c87

Browse files
authored
Merge branch 'master' into master
2 parents b84112d + cc9a6c0 commit 72c9c87

File tree

138 files changed

+8278
-134
lines changed

Some content is hidden

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

138 files changed

+8278
-134
lines changed

.all-contributorsrc

+122-1
Original file line numberDiff line numberDiff line change
@@ -2759,7 +2759,8 @@
27592759
"avatar_url": "https://avatars.githubusercontent.com/u/141746282?v=4",
27602760
"profile": "https://github.com/jnniu-n",
27612761
"contributions": [
2762-
"translation"
2762+
"translation",
2763+
"doc"
27632764
]
27642765
},
27652766
{
@@ -2831,6 +2832,126 @@
28312832
"name": "Doksanbir",
28322833
"avatar_url": "https://avatars.githubusercontent.com/u/7249450?v=4",
28332834
"profile": "https://github.com/ylcn91",
2835+
"contributions": [
2836+
"code",
2837+
"doc"
2838+
]
2839+
},
2840+
{
2841+
"login": "Chant3ll3",
2842+
"name": "Chant3ll3",
2843+
"avatar_url": "https://avatars.githubusercontent.com/u/141697333?v=4",
2844+
"profile": "https://github.com/Chant3ll3",
2845+
"contributions": [
2846+
"doc",
2847+
"translation"
2848+
]
2849+
},
2850+
{
2851+
"login": "hwan33",
2852+
"name": "YongHwan Kwon",
2853+
"avatar_url": "https://avatars.githubusercontent.com/u/67625677?v=4",
2854+
"profile": "https://hwan33.tistory.com/",
2855+
"contributions": [
2856+
"code"
2857+
]
2858+
},
2859+
{
2860+
"login": "takikuba",
2861+
"name": "Jakub Klimek",
2862+
"avatar_url": "https://avatars.githubusercontent.com/u/58841343?v=4",
2863+
"profile": "https://github.com/takikuba",
2864+
"contributions": [
2865+
"code"
2866+
]
2867+
},
2868+
{
2869+
"login": "bachbil",
2870+
"name": "believe",
2871+
"avatar_url": "https://avatars.githubusercontent.com/u/28935461?v=4",
2872+
"profile": "https://github.com/bachbil",
2873+
"contributions": [
2874+
"translation"
2875+
]
2876+
},
2877+
{
2878+
"login": "egg0102030405",
2879+
"name": "egg0102030405",
2880+
"avatar_url": "https://avatars.githubusercontent.com/u/59650695?v=4",
2881+
"profile": "https://github.com/egg0102030405",
2882+
"contributions": [
2883+
"translation",
2884+
"doc"
2885+
]
2886+
},
2887+
{
2888+
"login": "ved-asole",
2889+
"name": "Ved Asole",
2890+
"avatar_url": "https://avatars.githubusercontent.com/u/77259804?v=4",
2891+
"profile": "http://vedasole.cloud",
2892+
"contributions": [
2893+
"code"
2894+
]
2895+
},
2896+
{
2897+
"login": "Holiday-C",
2898+
"name": "NewMorning",
2899+
"avatar_url": "https://avatars.githubusercontent.com/u/95869761?v=4",
2900+
"profile": "https://github.com/Holiday-C",
2901+
"contributions": [
2902+
"translation"
2903+
]
2904+
},
2905+
{
2906+
"login": "Kiro-Young",
2907+
"name": "资深老萌新",
2908+
"avatar_url": "https://avatars.githubusercontent.com/u/98251397?v=4",
2909+
"profile": "https://github.com/Kiro-Young",
2910+
"contributions": [
2911+
"translation"
2912+
]
2913+
},
2914+
{
2915+
"login": "Nickolodeon98",
2916+
"name": "Seunghwan Jeon",
2917+
"avatar_url": "https://avatars.githubusercontent.com/u/113348293?v=4",
2918+
"profile": "https://itistori.tistory.com/",
2919+
"contributions": [
2920+
"translation"
2921+
]
2922+
},
2923+
{
2924+
"login": "sugan0tech",
2925+
"name": "sugavanesh",
2926+
"avatar_url": "https://avatars.githubusercontent.com/u/71312159?v=4",
2927+
"profile": "https://github.com/sugan0tech",
2928+
"contributions": [
2929+
"code"
2930+
]
2931+
},
2932+
{
2933+
"login": "FinnS-F",
2934+
"name": "FinnS-F",
2935+
"avatar_url": "https://avatars.githubusercontent.com/u/126026830?v=4",
2936+
"profile": "https://github.com/FinnS-F",
2937+
"contributions": [
2938+
"code"
2939+
]
2940+
},
2941+
{
2942+
"login": "jerryyummy",
2943+
"name": "jerryyummy",
2944+
"avatar_url": "https://avatars.githubusercontent.com/u/62087610?v=4",
2945+
"profile": "https://github.com/jerryyummy",
2946+
"contributions": [
2947+
"translation"
2948+
]
2949+
},
2950+
{
2951+
"login": "Manojkumarchow",
2952+
"name": "Manoj Chowdary",
2953+
"avatar_url": "https://avatars.githubusercontent.com/u/28005510?v=4",
2954+
"profile": "https://manojkumarchow.github.io/",
28342955
"contributions": [
28352956
"code"
28362957
]

README.md

+20-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=iluwatar_java-design-patterns&metric=coverage)](https://sonarcloud.io/dashboard?id=iluwatar_java-design-patterns)
1111
[![Join the chat at https://gitter.im/iluwatar/java-design-patterns](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/iluwatar/java-design-patterns?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1212
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
13-
[![All Contributors](https://img.shields.io/badge/all_contributors-311-orange.svg?style=flat-square)](#contributors-)
13+
[![All Contributors](https://img.shields.io/badge/all_contributors-324-orange.svg?style=flat-square)](#contributors-)
1414
<!-- ALL-CONTRIBUTORS-BADGE:END -->
1515

1616
<br/>
@@ -464,7 +464,7 @@ This project is licensed under the terms of the MIT license.
464464
</tr>
465465
<tr>
466466
<td align="center" valign="top" width="14.28%"><a href="http://www.linkedin.com/in/yenniferh"><img src="https://avatars.githubusercontent.com/u/19285706?v=4?s=100" width="100px;" alt="Yennifer Herrera"/><br /><sub><b>Yennifer Herrera</b></sub></a><br /><a href="#translation-Yenniferh" title="Translation">🌍</a> <a href="https://github.com/iluwatar/java-design-patterns/pulls?q=is%3Apr+reviewed-by%3AYenniferh" title="Reviewed Pull Requests">👀</a></td>
467-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jnniu-n"><img src="https://avatars.githubusercontent.com/u/141746282?v=4?s=100" width="100px;" alt="jnniu-n"/><br /><sub><b>jnniu-n</b></sub></a><br /><a href="#translation-jnniu-n" title="Translation">🌍</a></td>
467+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jnniu-n"><img src="https://avatars.githubusercontent.com/u/141746282?v=4?s=100" width="100px;" alt="jnniu-n"/><br /><sub><b>jnniu-n</b></sub></a><br /><a href="#translation-jnniu-n" title="Translation">🌍</a> <a href="https://github.com/iluwatar/java-design-patterns/commits?author=jnniu-n" title="Documentation">📖</a></td>
468468
<td align="center" valign="top" width="14.28%"><a href="https://github.com/miguel-is-coding"><img src="https://avatars.githubusercontent.com/u/48435117?v=4?s=100" width="100px;" alt="Miguel Angel Perez Garcia"/><br /><sub><b>Miguel Angel Perez Garcia</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/pulls?q=is%3Apr+reviewed-by%3Amiguel-is-coding" title="Reviewed Pull Requests">👀</a> <a href="#translation-miguel-is-coding" title="Translation">🌍</a></td>
469469
<td align="center" valign="top" width="14.28%"><a href="https://github.com/SuwanSankaja"><img src="https://avatars.githubusercontent.com/u/86839778?v=4?s=100" width="100px;" alt="Suwan Sankaja"/><br /><sub><b>Suwan Sankaja</b></sub></a><br /><a href="#translation-SuwanSankaja" title="Translation">🌍</a></td>
470470
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Iamalok007"><img src="https://avatars.githubusercontent.com/u/97467835?v=4?s=100" width="100px;" alt="alok"/><br /><sub><b>alok</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=Iamalok007" title="Documentation">📖</a></td>
@@ -474,7 +474,24 @@ This project is licensed under the terms of the MIT license.
474474
<tr>
475475
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jppf22"><img src="https://avatars.githubusercontent.com/u/104360594?v=4?s=100" width="100px;" alt="João Fernandes"/><br /><sub><b>João Fernandes</b></sub></a><br /><a href="#translation-jppf22" title="Translation">🌍</a></td>
476476
<td align="center" valign="top" width="14.28%"><a href="https://github.com/HongGeonUi"><img src="https://avatars.githubusercontent.com/u/89684956?v=4?s=100" width="100px;" alt="Hong Geon-ui"/><br /><sub><b>Hong Geon-ui</b></sub></a><br /><a href="#translation-HongGeonUi" title="Translation">🌍</a></td>
477-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ylcn91"><img src="https://avatars.githubusercontent.com/u/7249450?v=4?s=100" width="100px;" alt="Doksanbir"/><br /><sub><b>Doksanbir</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=ylcn91" title="Code">💻</a></td>
477+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ylcn91"><img src="https://avatars.githubusercontent.com/u/7249450?v=4?s=100" width="100px;" alt="Doksanbir"/><br /><sub><b>Doksanbir</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=ylcn91" title="Code">💻</a> <a href="https://github.com/iluwatar/java-design-patterns/commits?author=ylcn91" title="Documentation">📖</a></td>
478+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Chant3ll3"><img src="https://avatars.githubusercontent.com/u/141697333?v=4?s=100" width="100px;" alt="Chant3ll3"/><br /><sub><b>Chant3ll3</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=Chant3ll3" title="Documentation">📖</a> <a href="#translation-Chant3ll3" title="Translation">🌍</a></td>
479+
<td align="center" valign="top" width="14.28%"><a href="https://hwan33.tistory.com/"><img src="https://avatars.githubusercontent.com/u/67625677?v=4?s=100" width="100px;" alt="YongHwan Kwon"/><br /><sub><b>YongHwan Kwon</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=hwan33" title="Code">💻</a></td>
480+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/takikuba"><img src="https://avatars.githubusercontent.com/u/58841343?v=4?s=100" width="100px;" alt="Jakub Klimek"/><br /><sub><b>Jakub Klimek</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=takikuba" title="Code">💻</a></td>
481+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bachbil"><img src="https://avatars.githubusercontent.com/u/28935461?v=4?s=100" width="100px;" alt="believe"/><br /><sub><b>believe</b></sub></a><br /><a href="#translation-bachbil" title="Translation">🌍</a></td>
482+
</tr>
483+
<tr>
484+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/egg0102030405"><img src="https://avatars.githubusercontent.com/u/59650695?v=4?s=100" width="100px;" alt="egg0102030405"/><br /><sub><b>egg0102030405</b></sub></a><br /><a href="#translation-egg0102030405" title="Translation">🌍</a> <a href="https://github.com/iluwatar/java-design-patterns/commits?author=egg0102030405" title="Documentation">📖</a></td>
485+
<td align="center" valign="top" width="14.28%"><a href="http://vedasole.cloud"><img src="https://avatars.githubusercontent.com/u/77259804?v=4?s=100" width="100px;" alt="Ved Asole"/><br /><sub><b>Ved Asole</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=ved-asole" title="Code">💻</a></td>
486+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Holiday-C"><img src="https://avatars.githubusercontent.com/u/95869761?v=4?s=100" width="100px;" alt="NewMorning"/><br /><sub><b>NewMorning</b></sub></a><br /><a href="#translation-Holiday-C" title="Translation">🌍</a></td>
487+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Kiro-Young"><img src="https://avatars.githubusercontent.com/u/98251397?v=4?s=100" width="100px;" alt="资深老萌新"/><br /><sub><b>资深老萌新</b></sub></a><br /><a href="#translation-Kiro-Young" title="Translation">🌍</a></td>
488+
<td align="center" valign="top" width="14.28%"><a href="https://itistori.tistory.com/"><img src="https://avatars.githubusercontent.com/u/113348293?v=4?s=100" width="100px;" alt="Seunghwan Jeon"/><br /><sub><b>Seunghwan Jeon</b></sub></a><br /><a href="#translation-Nickolodeon98" title="Translation">🌍</a></td>
489+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sugan0tech"><img src="https://avatars.githubusercontent.com/u/71312159?v=4?s=100" width="100px;" alt="sugavanesh"/><br /><sub><b>sugavanesh</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=sugan0tech" title="Code">💻</a></td>
490+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/FinnS-F"><img src="https://avatars.githubusercontent.com/u/126026830?v=4?s=100" width="100px;" alt="FinnS-F"/><br /><sub><b>FinnS-F</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=FinnS-F" title="Code">💻</a></td>
491+
</tr>
492+
<tr>
493+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jerryyummy"><img src="https://avatars.githubusercontent.com/u/62087610?v=4?s=100" width="100px;" alt="jerryyummy"/><br /><sub><b>jerryyummy</b></sub></a><br /><a href="#translation-jerryyummy" title="Translation">🌍</a></td>
494+
<td align="center" valign="top" width="14.28%"><a href="https://manojkumarchow.github.io/"><img src="https://avatars.githubusercontent.com/u/28005510?v=4?s=100" width="100px;" alt="Manoj Chowdary"/><br /><sub><b>Manoj Chowdary</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=Manojkumarchow" title="Code">💻</a></td>
478495
</tr>
479496
</tbody>
480497
</table>

abstract-document/README.md

+37-23
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,18 @@ title: Abstract Document
33
category: Structural
44
language: en
55
tag:
6-
- Extensibility
6+
- Abstraction
7+
- Extensibility
8+
- Decoupling
79
---
810

911
## Intent
1012

11-
The "Abstract Document" design pattern is a structural design pattern that aims to provide a consistent way to handle
12-
hierarchical and tree-like data structures by defining a common interface for various document types.
13+
The Abstract Document design pattern is a structural design pattern that aims to provide a consistent way to handle hierarchical and tree-like data structures by defining a common interface for various document types. It separates the core document structure from specific data formats, enabling dynamic updates and simplified maintenance.
1314

1415
## Explanation
1516

16-
The Abstract Document pattern enables handling additional, non-static properties. This pattern
17-
uses concept of traits to enable type safety and separate properties of different classes into
18-
set of interfaces.
17+
The Abstract Document pattern enables handling additional, non-static properties. This pattern uses concept of traits to enable type safety and separate properties of different classes into set of interfaces.
1918

2019
Real world example
2120

@@ -27,16 +26,11 @@ In plain words
2726
2827
Wikipedia says
2928

30-
> An object-oriented structural design pattern for organizing objects in loosely typed key-value stores and exposing
31-
the data using typed views. The purpose of the pattern is to achieve a high degree of flexibility between components
32-
in a strongly typed language where new properties can be added to the object-tree on the fly, without losing the
33-
support of type-safety. The pattern makes use of traits to separate different properties of a class into different
34-
interfaces.
29+
> An object-oriented structural design pattern for organizing objects in loosely typed key-value stores and exposing the data using typed views. The purpose of the pattern is to achieve a high degree of flexibility between components in a strongly typed language where new properties can be added to the object-tree on the fly, without losing the support of type-safety. The pattern makes use of traits to separate different properties of a class into different interfaces.
3530
3631
**Programmatic Example**
3732

38-
Let's first define the base classes `Document` and `AbstractDocument`. They basically make the object hold a property
39-
map and any amount of child objects.
33+
Let's first define the base classes `Document` and `AbstractDocument`. They basically make the object hold a property map and any amount of child objects.
4034

4135
```java
4236
public interface Document {
@@ -81,8 +75,7 @@ public abstract class AbstractDocument implements Document {
8175
...
8276
}
8377
```
84-
Next we define an enum `Property` and a set of interfaces for type, price, model and parts. This allows us to create
85-
static looking interface to our `Car` class.
78+
Next we define an enum `Property` and a set of interfaces for type, price, model and parts. This allows us to create static looking interface to our `Car` class.
8679

8780
```java
8881
public enum Property {
@@ -176,9 +169,7 @@ And finally here's how we construct and use the `Car` in a full example.
176169
177170
## Applicability
178171
179-
This pattern is particularly useful in scenarios where you have different types of documents that share some common
180-
attributes or behaviors, but also have unique attributes or behaviors specific to their individual types. Here are
181-
some scenarios where the Abstract Document design pattern can be applicable:
172+
This pattern is particularly useful in scenarios where you have different types of documents that share some common attributes or behaviors, but also have unique attributes or behaviors specific to their individual types. Here are some scenarios where the Abstract Document design pattern can be applicable:
182173
183174
* Content Management Systems (CMS): In a CMS, you might have various types of content such as articles, images, videos, etc. Each type of content could have shared attributes like creation date, author, and tags, while also having specific attributes like image dimensions for images or video duration for videos.
184175
@@ -194,13 +185,36 @@ some scenarios where the Abstract Document design pattern can be applicable:
194185

195186
* Project Management Tools: In project management applications, you could have different types of tasks like to-do items, milestones, and issues. The Abstract Document pattern could be used to handle general attributes like task name and assignee, while allowing for specific attributes like milestone date or issue priority.
196187

197-
The key idea behind the Abstract Document design pattern is to provide a flexible and extensible way to manage different
198-
types of documents or entities with shared and distinct attributes. By defining a common interface and implementing it
199-
across various document types, you can achieve a more organized and consistent approach to handling complex data
200-
structures.
188+
* Documents have diverse and evolving attribute structures.
189+
190+
* Dynamically adding new properties is a common requirement.
191+
192+
* Decoupling data access from specific formats is crucial.
193+
194+
* Maintainability and flexibility are critical for the codebase.
195+
196+
The key idea behind the Abstract Document design pattern is to provide a flexible and extensible way to manage different types of documents or entities with shared and distinct attributes. By defining a common interface and implementing it across various document types, you can achieve a more organized and consistent approach to handling complex data structures.
197+
198+
## Consequences
199+
200+
Benefits
201+
202+
* Flexibility: Accommodates varied document structures and properties.
203+
204+
* Extensibility: Dynamically add new attributes without breaking existing code.
205+
206+
* Maintainability: Promotes clean and adaptable code due to separation of concerns.
207+
208+
* Reusability: Typed views enable code reuse for accessing specific attribute types.
209+
210+
Trade-offs
211+
212+
* Complexity: Requires defining interfaces and views, adding implementation overhead.
213+
214+
* Performance: Might introduce slight performance overhead compared to direct data access.
201215

202216
## Credits
203217

204218
* [Wikipedia: Abstract Document Pattern](https://en.wikipedia.org/wiki/Abstract_Document_Pattern)
205219
* [Martin Fowler: Dealing with properties](http://martinfowler.com/apsupp/properties.pdf)
206-
* [Pattern-Oriented Software Architecture Volume 4: A Pattern Language for Distributed Computing (v. 4)](https://www.amazon.com/gp/product/0470059028/ref=as_li_qf_asin_il_tl?ie=UTF8&tag=javadesignpat-20&creative=9325&linkCode=as2&creativeASIN=0470059028&linkId=e3aacaea7017258acf184f9f3283b492)
220+
* [Pattern-Oriented Software Architecture Volume 4: A Pattern Language for Distributed Computing (v. 4)](https://amzn.to/49zRP4R)

0 commit comments

Comments
 (0)