diff --git a/game-loop/README.md b/game-loop/README.md index 69d2d6411..3de2804a8 100644 --- a/game-loop/README.md +++ b/game-loop/README.md @@ -34,6 +34,10 @@ Wikipedia says > The central component of any game, from a programming standpoint, is the game loop. The game loop allows the game to run smoothly regardless of a user's input, or lack thereof. +Flowchart + +![Game Loop flowchart](./etc/game-loop-flowchart.png) + ## Programmatic Example of Game Loop Pattern in Java In our Java example, we illustrate a simple game loop controlling a bullet's movement, updating its position, ensuring smooth rendering, and responding to user inputs. The Game Loop is the main process driving all game rendering threads, present in all modern games. It handles input processing, internal status updates, rendering, AI, and other processes. Starting with a simple `Bullet` class, we demonstrate the movement of bullets in our game, focusing on their 1-dimensional position for demonstration purposes. diff --git a/game-loop/etc/game-loop-flowchart.png b/game-loop/etc/game-loop-flowchart.png new file mode 100644 index 000000000..a3e73f75e Binary files /dev/null and b/game-loop/etc/game-loop-flowchart.png differ diff --git a/gateway/README.md b/gateway/README.md index 0df5d1b74..79c1a24f1 100644 --- a/gateway/README.md +++ b/gateway/README.md @@ -35,6 +35,10 @@ Wikipedia says > A server that acts as an API front-end, receives API requests, enforces throttling and security policies, passes requests to the back-end service and then passes the response back to the requester. +Sequence diagram + +![Gateway sequence diagram](./etc/gateway-sequence-diagram.png) + ## Programmatic Example of Gateway Pattern in Java First, we define a `Gateway` interface. This interface represents the contract for our external services. Each service that we want to interact with will implement this interface. diff --git a/gateway/etc/gateway-sequence-diagram.png b/gateway/etc/gateway-sequence-diagram.png new file mode 100644 index 000000000..167dff8ec Binary files /dev/null and b/gateway/etc/gateway-sequence-diagram.png differ diff --git a/guarded-suspension/README.md b/guarded-suspension/README.md index f13e40684..af0ec85d0 100644 --- a/guarded-suspension/README.md +++ b/guarded-suspension/README.md @@ -35,6 +35,10 @@ Wikipedia says > In concurrent programming, Guarded Suspension manages operations requiring a lock and a precondition, delaying execution until the precondition is met. +Sequence diagram + +![Guarded Suspension sequence diagram](./etc/guarded-suspension-sequence-diagram.png) + ## Programmatic Example of Guarded Suspension Pattern in Java The `GuardedQueue` class in Java showcases concurrent programming using the Guarded Suspension pattern. It includes synchronized methods that manage thread management and synchronization, demonstrating how threads wait for the right conditions to execute. diff --git a/guarded-suspension/etc/guarded-suspension-sequence-diagram.png b/guarded-suspension/etc/guarded-suspension-sequence-diagram.png new file mode 100644 index 000000000..ee7752815 Binary files /dev/null and b/guarded-suspension/etc/guarded-suspension-sequence-diagram.png differ diff --git a/half-sync-half-async/README.md b/half-sync-half-async/README.md index 784197023..95fec081d 100644 --- a/half-sync-half-async/README.md +++ b/half-sync-half-async/README.md @@ -34,6 +34,10 @@ Wikipedia says > The Half-Sync/Half-Async design pattern is used to solve situations where one part of the application runs synchronously while another runs asynchronously, and the two modules need to communicate with each other. +Sequence diagram + +![Half-Sync/Half-Async sequence diagram](./etc/half-sync-half-async-sequence-diagram.png) + ## Programmatic Example of Half-Sync/Half-Async Pattern in Java The Half-Sync/Half-Async design pattern is a concurrency pattern that separates synchronous and asynchronous processing in a system, simplifying the programming model without affecting performance. It's particularly useful in scenarios where you have a mix of short, mid, and long duration tasks. diff --git a/half-sync-half-async/etc/half-sync-half-async-sequence-diagram.png b/half-sync-half-async/etc/half-sync-half-async-sequence-diagram.png new file mode 100644 index 000000000..f7fdabbe2 Binary files /dev/null and b/half-sync-half-async/etc/half-sync-half-async-sequence-diagram.png differ diff --git a/health-check/README.md b/health-check/README.md index 23c7f74f7..f6fe0762f 100644 --- a/health-check/README.md +++ b/health-check/README.md @@ -30,6 +30,10 @@ In plain words > The Health Check Pattern is like a regular doctor's visit for services in a microservices architecture. It helps in early detection of issues and ensures that services are healthy and available. +Sequence diagram + +![Health Check sequence diagram](./etc/health-check-sequence-diagram.png) + ## Programmatic Example of Health Check Pattern in Java The Health Check design pattern is particularly useful in distributed systems where the health of individual components can affect the overall health of the system. Using Spring Boot Actuator, developers can easily implement health checks in Java applications. diff --git a/health-check/etc/health-check-sequence-diagram.png b/health-check/etc/health-check-sequence-diagram.png new file mode 100644 index 000000000..65ddb26ab Binary files /dev/null and b/health-check/etc/health-check-sequence-diagram.png differ diff --git a/hexagonal-architecture/README.md b/hexagonal-architecture/README.md index 636487363..d6fea210a 100644 --- a/hexagonal-architecture/README.md +++ b/hexagonal-architecture/README.md @@ -173,10 +173,6 @@ Running the main function of App class produces the following output: In this example, the `LotteryAdministration` and `LotteryService` classes are the core of the application. They interact with external interfaces like `LotteryTicketRepository`, `LotteryEventLog`, and `WireTransfers` through dependency injection, keeping the core business logic decoupled from external concerns. This is a basic example of the Hexagonal Architecture pattern, where the core application is at the center of input/output systems. -## Detailed Explanation of Hexagonal Architecture Pattern with Real-World Examples - -![Hexagonal Architecture class diagram](./etc/hexagonal.png) - ## When to Use the Hexagonal Architecture Pattern in Java Hexagonal Architecture is particularly beneficial in scenarios: