mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-13 20:14:59 +00:00
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:
1 parent
72eeb167c5
commit
8d5cb59388
24 files changed
+48
-4
No files matched your search
+4
-4
@@ -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
|
||||
|
||||

|
||||
|
||||
## 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
|
||||
|
||||

|
||||
|
||||
## When to Use the Mediator Pattern in Java
|
||||
|
||||
Use the Mediator pattern when
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
Reference in new issue
Block a user