Skip to content

Commit 8d5cb59

Browse files
committed
docs: add diagrams for marker interface, master-worker, mediator, memento, metadata mapping, microservices api gateway, microservices log aggregation, monad, monitor, monostate, multiton, mute idiom
1 parent 72eeb16 commit 8d5cb59

24 files changed

+48
-4
lines changed

marker-interface/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ Wikipedia says
3737
>
3838
> To use this pattern, a class implements a marker interface (also called tagging interface) which is an empty interface, and methods that interact with instances of that class test for the existence of the interface. Whereas a typical interface specifies functionality (in the form of method declarations) that an implementing class must support, a marker interface need not do so. The mere presence of such an interface indicates specific behavior on the part of the implementing class. Hybrid interfaces, which both act as markers and specify required methods, are possible but may prove confusing if improperly used.
3939
40+
Flowchart
41+
42+
![Marker Interface flowchart](./etc/marker-interface-flowchart.png)
43+
4044
## Programmatic Example of Marker Interface Pattern in Java
4145

4246
The Marker Interface design pattern is a design pattern in computer science that is used with languages that provide run-time type information about objects. It provides a means to associate metadata with a class where the language does not have explicit support for such metadata.
82.7 KB
Loading

master-worker/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ Wikipedia says
3333

3434
> Master–slave is a model of asymmetric communication or control where one device or process (the master) controls one or more other devices or processes (the slaves) and serves as their communication hub. In some systems, a master is selected from a group of eligible devices, with the other devices acting in the role of slaves.
3535
36+
Sequence diagram
37+
38+
![Master-Worker sequence diagram](./etc/master-worker-sequence-diagram.png)
39+
3640
## Programmatic Example of Master-Worker Pattern in Java
3741

3842
In the provided code, the `MasterWorker` class initiates the concurrent computation process. The `Master` class divides the work among `Worker` objects, each performing its task in parallel, thus optimizing task processing and enhancing system efficiency.
53.3 KB
Loading

mediator/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ Wikipedia says
3333

3434
> In software engineering, the mediator pattern defines an object that encapsulates how a set of objects interact. This pattern is considered to be a behavioral pattern due to the way it can alter the program's running behavior. In object-oriented programming, programs often consist of many classes. Business logic and computation are distributed among these classes. However, as more classes are added to a program, especially during maintenance and/or refactoring, the problem of communication between these classes may become more complex. This makes the program harder to read and maintain. Furthermore, it can become difficult to change the program, since any change may affect code in several other classes. With the mediator pattern, communication between objects is encapsulated within a mediator object. Objects no longer communicate directly with each other, but instead communicate through the mediator. This reduces the dependencies between communicating objects, thereby reducing coupling.
3535
36+
Sequence diagram
37+
38+
![Mediator sequence diagram](./etc/mediator-sequence-diagram.png)
39+
3640
## Programmatic Example of Mediator Pattern in Java
3741

3842
In this example, the mediator encapsulates how a set of objects interact. Instead of referring to each other directly, they use the mediator interface.
@@ -175,10 +179,6 @@ Here's the console output from running the example.
175179
14:05:15.083 [main] INFO com.iluwatar.mediator.PartyMemberBase -- Rogue arrives for dinner
176180
```
177181

178-
## Detailed Explanation of Mediator Pattern with Real-World Examples
179-
180-
![Mediator](./etc/mediator_1.png "Mediator")
181-
182182
## When to Use the Mediator Pattern in Java
183183

184184
Use the Mediator pattern when
34.4 KB
Loading

memento/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ Wikipedia says
3636

3737
> The memento pattern is a software design pattern that provides the ability to restore an object to its previous state (undo via rollback).
3838
39+
Sequence diagram
40+
41+
![Memento sequence diagram](./etc/memento-sequence-diagram.png)
42+
3943
## Programmatic Example of Memento Pattern in Java
4044

4145
In our astrology application, we use the Memento pattern to capture and restore the state of star objects. Each state is saved as a memento, allowing us to revert to previous states as needed.
42.1 KB
Loading

metadata-mapping/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ Wikipedia says
2929

3030
> Create a "virtual [object database](https://en.wikipedia.org/wiki/Object_database)" that can be used from within the programming language.
3131
32+
Flowchart
33+
34+
![Metadata Mapping flowchart](./etc/metadata-mapping-flowchart.png)
35+
3236
## Programmatic Example of Metadata Mapping Pattern in Java
3337

3438
Hibernate ORM Tool uses Metadata Mapping Pattern to specify the mapping between classes and tables either using XML or annotations in code.
72.7 KB
Loading

0 commit comments

Comments
 (0)