mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-13 00:14:43 +00:00
docs: updates to several patterns
This commit is contained in:
1 parent
4652842c94
commit
584e949714
70 files changed
+347
-479
No files matched your search
+4
-4
@@ -50,14 +50,18 @@ public class ExternalServiceA implements Gateway {
|
||||
// Implementation for ExternalServiceA
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```java
|
||||
public class ExternalServiceB implements Gateway {
|
||||
@Override
|
||||
public void execute() {
|
||||
// Implementation for ExternalServiceB
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```java
|
||||
public class ExternalServiceC implements Gateway {
|
||||
@Override
|
||||
public void execute() {
|
||||
@@ -122,10 +126,6 @@ Running the example produces the following output.
|
||||
|
||||
This example demonstrates how the Gateway design pattern can be used to simplify the interaction with multiple external services. Each service is encapsulated behind a common interface, and the application interacts with this interface rather than directly with the services. This reduces coupling and makes the application easier to maintain and extend.
|
||||
|
||||
## Class diagram
|
||||
|
||||

|
||||
|
||||
## Applicability
|
||||
|
||||
Use the Gateway pattern when you need to integrate with remote services or APIs, and you want to minimize the coupling between your application and external systems. It is particularly useful in microservices architectures where different services need to communicate through well-defined APIs.
|
||||
|
||||
Reference in new issue
Block a user