Skip to content

Commit aef4b37

Browse files
committed
docs: add diagrams for event aggregator, event-based asynchronous, event queue, execute around, extension objects
1 parent 30d1308 commit aef4b37

File tree

10 files changed

+20
-8
lines changed

10 files changed

+20
-8
lines changed

Diff for: event-aggregator/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ In Plain Words
3636

3737
> Event Aggregator is a design pattern that allows multiple event sources to communicate with event handlers through a central point, rather than having each event source communicate directly with each handler.
3838
39+
Sequence diagram
40+
41+
![Event Aggregator sequence diagram](./etc/event-aggregator-sequence-diagram.png)
42+
3943
## Programmatic Example of Event Aggregator Pattern in Java
4044

4145
Consider the following example where we use the Event Aggregator to handle multiple events.
@@ -161,10 +165,6 @@ The console output after running the example.
161165
21:37:38.739 [main] INFO com.iluwatar.event.aggregator.KingJoffrey -- Received event from the King's Hand: Traitor detected
162166
```
163167

164-
## Detailed Explanation of Event Aggregator Pattern with Real-World Examples
165-
166-
![Event Aggregator](./etc/classes.png "Event Aggregator")
167-
168168
## When to Use the Event Aggregator Pattern in Java
169169

170170
Use the Event Aggregator pattern when
30.7 KB
Loading

Diff for: event-based-asynchronous/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ In Plain Words
3232

3333
> The Event-Based Asynchronous design pattern allows tasks to be executed in the background, notifying the main program via events when completed, thereby enhancing system efficiency and responsiveness without blocking ongoing operations.
3434
35+
Sequence diagram
36+
37+
![Event-Based Asynchronous sequence diagram](./etc/event-based-asynchronous-sequence-diagram.png)
38+
3539
## Programmatic Example of Event-Based Asynchronous Pattern in Java
3640

3741
Event-Based Asynchronous design pattern allows tasks to be executed in the background, notifying the main program via events when completed, thereby enhancing system efficiency and responsiveness without blocking ongoing operations.
Loading

Diff for: event-queue/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Wikipedia says
3535

3636
> Message queues (also known as event queues) implement an asynchronous communication pattern between two or more processes/threads whereby the sending and receiving party do not need to interact with the queue at the same time.
3737
38+
Sequence diagram
39+
40+
![Event Queue sequence diagram](./etc/event-queue-sequence-diagram.png)
41+
3842
## Programmatic Example of Event Queue Pattern in Java
3943

4044
This example demonstrates an application using an event queue system to handle audio playback asynchronously.

Diff for: event-queue/etc/event-queue-sequence-diagram.png

45.1 KB
Loading

Diff for: execute-around/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ In plain words
3939

4040
> Basically it's the pattern where you write a method to do things which are always required, e.g. resource allocation and clean-up, and make the caller pass in "what we want to do with the resource".
4141
42+
Flowchart
43+
44+
![Execute Around flowchart](./etc/execute-around-flowchart.png)
45+
4246
## Programmatic Example of Execute Around Pattern in Java
4347

4448
The Execute Around Pattern is a design pattern that is widely used in Java programming to manage resource allocation and deallocation. It ensures that important setup and cleanup operations are performed reliably around a core business operation. This pattern is particularly useful for resource management, such as handling files, databases, or network connections in Java applications.

Diff for: execute-around/etc/execute-around-flowchart.png

27 KB
Loading

Diff for: extension-objects/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ Wikipedia says
3333

3434
> In object-oriented computer programming, an extension objects pattern is a design pattern added to an object after the original object was compiled. The modified object is often a class, a prototype or a type. Extension object patterns are features of some object-oriented programming languages. There is no syntactic difference between calling an extension method and calling a method declared in the type definition.
3535
36+
Sequence diagram
37+
38+
![Extension Objects sequence diagram](./etc/extension-objects-sequence-diagram.png)
39+
3640
## Programmatic Example of Extension Objects Pattern in Java
3741

3842
The Extension Objects pattern allows for the flexible extension of an object's behavior without modifying its structure, by attaching additional objects that can dynamically add new functionality.
@@ -143,10 +147,6 @@ This produces the following console output.
143147

144148
This example demonstrates how the Extension Objects pattern allows for the flexible extension of an object's behavior without modifying its structure.
145149

146-
## Detailed Explanation of Extension Objects Pattern with Real-World Examples
147-
148-
![Extension_objects](./etc/extension_obj.png "Extension objects")
149-
150150
## When to Use the Extension Objects Pattern in Java
151151

152152
This pattern is applicable in scenarios where an object's functionality needs to be extended at runtime, avoiding the complications of subclassing. It's particularly useful in systems where object capabilities need to be augmented post-deployment, or where the capabilities might vary significantly across instances.
31.9 KB
Loading

0 commit comments

Comments
 (0)