docs: add diagrams for marker interface, master-worker, mediator, memento, metadata mapping, microservices api gateway, microservices log aggregation, monad, monitor, monostate, multiton, mute idiom

This commit is contained in:
Ilkka Seppälä committed 2025-04-07 22:14:20 +03:00
1 parent 72eeb167c5
commit 8d5cb59388
24 files changed
+48 -4

No files matched your search

+4 -4
View File
@@ -33,6 +33,10 @@ Wikipedia says
> 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.
Sequence diagram
![Mediator sequence diagram](./etc/mediator-sequence-diagram.png)
## Programmatic Example of Mediator Pattern in Java
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.
14:05:15.083 [main] INFO com.iluwatar.mediator.PartyMemberBase -- Rogue arrives for dinner
```
## Detailed Explanation of Mediator Pattern with Real-World Examples
![Mediator](./etc/mediator_1.png "Mediator")
## When to Use the Mediator Pattern in Java
Use the Mediator pattern when
Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB