Skip to content

Commit 584e949

Browse files
committed
docs: updates to several patterns
1 parent 4652842 commit 584e949

File tree

70 files changed

+344
-476
lines changed

Some content is hidden

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

70 files changed

+344
-476
lines changed

abstract-document/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The Abstract Document design pattern is a structural design pattern that aims to
1919

2020
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.
2121

22-
Real world example
22+
Real-world example
2323

2424
> Imagine a library system where books can have different formats and attributes: physical books, eBooks, and audiobooks. Each format has unique properties, such as page count for physical books, file size for eBooks, and duration for audiobooks. The Abstract Document design pattern allows the library system to manage these diverse formats flexibly. By using this pattern, the system can store and retrieve properties dynamically, without needing a rigid structure for each book type, making it easier to add new formats or attributes in the future without significant changes to the codebase.
2525

active-object/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,20 @@ public abstract class ActiveCreature {
9999
}
100100
```
101101

102-
We can see that any class that will extend the ActiveCreature class will have its own thread of control to invoke and execute methods.
102+
We can see that any class that will extend the `ActiveCreature` class will have its own thread of control to invoke and execute methods.
103103

104-
For example, the Orc class:
104+
For example, the `Orc` class:
105105

106106
```java
107107
public class Orc extends ActiveCreature {
108108

109109
public Orc(String name) {
110110
super(name);
111111
}
112-
113112
}
114113
```
115114

116-
Now, we can create multiple creatures such as Orcs, tell them to eat and roam, and they will execute it on their own thread of control:
115+
Now, we can create multiple creatures such as orcs, tell them to eat and roam, and they will execute it on their own thread of control:
117116

118117
```java
119118
public class App implements Runnable {

acyclic-visitor/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The Acyclic Visitor pattern decouples operations from an object hierarchy, allow
1515

1616
## Explanation
1717

18-
Real world example
18+
Real-world example
1919

2020
> An analogous real-world example of the Acyclic Visitor pattern is a museum guide system. Imagine a museum with various exhibits like paintings, sculptures, and historical artifacts. The museum has different types of guides (audio guide, human guide, virtual reality guide) that provide information about each exhibit. Instead of modifying the exhibits every time a new guide type is introduced, each guide implements an interface to visit different exhibit types. This way, the museum can add new types of guides without altering the existing exhibits, ensuring that the system remains extensible and maintainable without forming any dependency cycles.
2121

adapter/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ The program outputs:
106106
10:25:08.074 [main] INFO com.iluwatar.adapter.FishingBoat -- The fishing boat is sailing
107107
```
108108

109-
## Class diagram
110-
111-
![Adapter](./etc/adapter.urm.png "Adapter class diagram")
112-
113109
## Applicability
114110

115111
Use the Adapter pattern when

aggregator-microservices/README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ To aggregate responses from multiple microservices and return a consolidated res
1818

1919
## Explanation
2020

21-
Real world example
21+
Real-world example
2222

2323
> Imagine an online travel booking platform. When a user searches for a vacation package, the platform needs to gather information from several different services: flights, hotels, car rentals, and local attractions. Instead of the user making separate requests to each service, the platform employs an Aggregator Microservice. This microservice calls each of these services, collects their responses, and then consolidates the information into a single, unified response that is sent back to the user. This simplifies the user experience by providing all necessary travel details in one place and reduces the number of direct interactions the user needs to have with the underlying services.
2424
@@ -98,10 +98,6 @@ curl http://localhost:50004/product
9898
{"title":"The Product Title.","productInventories":5}
9999
```
100100

101-
## Class diagram
102-
103-
![Class diagram of the Aggregator Microservices Pattern](./aggregator-service/etc/aggregator-service.png "Aggregator Microservice")
104-
105101
## Applicability
106102

107103
The Aggregator Microservices Design Pattern is particularly useful in scenarios where a client requires a composite response that is assembled from data provided by multiple microservices. Common use cases include e-commerce applications where product details, inventory, and reviews might be provided by separate services, or in dashboard applications where aggregated data from various services is displayed in a unified view.

ambassador/README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Provide a helper service instance on a client and offload common functionality a
2121

2222
## Explanation
2323

24-
Real world example
24+
Real-world example
2525

2626
> Imagine a busy hotel where guests frequently request restaurant reservations, event tickets, or transportation arrangements. Instead of each guest individually contacting these services, the hotel provides a concierge. The concierge handles these tasks on behalf of the guests, ensuring that reservations are made smoothly, tickets are booked on time, and transportation is scheduled efficiently.
2727
>
@@ -175,10 +175,6 @@ Failed to reach remote:(3)
175175
Service result:-1
176176
```
177177

178-
## Class diagram
179-
180-
![Ambassador](./etc/ambassador.urm.png "Ambassador class diagram")
181-
182178
## Applicability
183179

184180
* Cloud Native and Microservices Architectures: Especially useful in distributed systems where it's crucial to monitor, log, and secure inter-service communication.

anti-corruption-layer/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ public class LegacyShop {
129129
}
130130
```
131131

132-
## Class diagram
133-
134-
![Anti-Corruption Layer](./etc/anti-corruption-layer.urm.png "Anti-Corruption Layer class diagram")
135-
136132
## Applicability
137133

138134
Use this pattern when:

api-gateway/README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The API Gateway design pattern aims to provide a unified interface to a set of m
2424

2525
## Explanation
2626

27-
Real world example
27+
Real-world example
2828

2929
> In a large e-commerce platform, an API Gateway is used as the single entry point for all client requests. When a user visits the site or uses the mobile app, their requests for product information, user authentication, order processing, and payment are all routed through the API Gateway. The gateway handles tasks such as user authentication, rate limiting to prevent abuse, and logging for monitoring purposes. This setup simplifies the client interface and ensures that all backend microservices, like the product catalog service, user service, order service, and payment service, can evolve independently without affecting the client directly. This also enhances security by providing a centralized point to enforce policies and monitor traffic.
3030
@@ -125,10 +125,6 @@ public class ApiGateway {
125125
}
126126
```
127127

128-
## Class diagram
129-
130-
![API Gateway](./etc/api-gateway.png "API Gateway")
131-
132128
## Applicability
133129

134130
* When building a microservices architecture, and there's a need to abstract the complexity of microservices from the client.

async-method-invocation/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,6 @@ Here's the program console output.
153153
21:47:08.618[main]INFO com.iluwatar.async.method.invocation.App-Space rocket<50>launch complete
154154
```
155155

156-
# Class diagram
157-
158-
![Async Method Invocation](./etc/async-method-invocation.urm.png "Async Method Invocation")
159-
160156
## Applicability
161157

162158
Use the async method invocation pattern when

balking/README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Balking Pattern is used to prevent an object from executing a certain code if it
1515

1616
## Explanation
1717

18-
Real world example
18+
Real-world example
1919

2020
> A real-world analogy of the Balking design pattern can be seen in a laundry service. Imagine a washing machine at a laundromat that only starts washing clothes if the door is properly closed and locked. If a user tries to start the machine while the door is open, the machine balks and does nothing. This ensures that the washing process only begins when it is safe to do so, preventing water spillage and potential damage to the machine. Similarly, the Balking pattern in software design ensures that operations are only executed when the object is in an appropriate state, preventing erroneous actions and maintaining system stability.
2121
@@ -31,7 +31,7 @@ Wikipedia says
3131

3232
There's a start-button in a washing machine to initiate the laundry washing. When the washing machine is inactive the button works as expected, but if it's already washing the button does nothing.
3333

34-
In this example implementation, `WashingMachine` is an object that has two states in which it can be: ENABLED and WASHING. If the machine is ENABLED, the state changes to WASHING using a thread-safe method. On the other hand, if it already has been washing and any other thread executes `wash()`it won't do that and returns without doing anything.
34+
In this example implementation, `WashingMachine` is an object that has two states in which it can be: ENABLED and WASHING. If the machine is ENABLED, the state changes to WASHING using a thread-safe method. On the other hand, if it already has been washing and any other thread executes `wash`it won't do that and returns without doing anything.
3535

3636
Here are the relevant parts of the `WashingMachine` class.
3737

@@ -114,10 +114,6 @@ Here is the console output of the program.
114114
14:02:52.324 [pool-1-thread-2] INFO com.iluwatar.balking.WashingMachine - 14: Washing completed.
115115
```
116116

117-
## Class diagram
118-
119-
![Balking](./etc/balking.png "Balking")
120-
121117
## Applicability
122118

123119
Use the Balking pattern when

0 commit comments

Comments
 (0)