Skip to content

Commit 9d23a23

Browse files
committed
docs: add new diagrams for game loop, gateway, guarded suspension, half-sync/half-async, health check
1 parent 9b64cde commit 9d23a23

File tree

11 files changed

+20
-4
lines changed

11 files changed

+20
-4
lines changed

game-loop/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ Wikipedia says
3434

3535
> 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.
3636
37+
Flowchart
38+
39+
![Game Loop flowchart](./etc/game-loop-flowchart.png)
40+
3741
## Programmatic Example of Game Loop Pattern in Java
3842

3943
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.

game-loop/etc/game-loop-flowchart.png

44.6 KB
Loading

gateway/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Wikipedia says
3535

3636
> 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.
3737
38+
Sequence diagram
39+
40+
![Gateway sequence diagram](./etc/gateway-sequence-diagram.png)
41+
3842
## Programmatic Example of Gateway Pattern in Java
3943

4044
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.
30.1 KB
Loading

guarded-suspension/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Wikipedia says
3535

3636
> In concurrent programming, Guarded Suspension manages operations requiring a lock and a precondition, delaying execution until the precondition is met.
3737
38+
Sequence diagram
39+
40+
![Guarded Suspension sequence diagram](./etc/guarded-suspension-sequence-diagram.png)
41+
3842
## Programmatic Example of Guarded Suspension Pattern in Java
3943

4044
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.
Loading

half-sync-half-async/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ Wikipedia says
3434

3535
> 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.
3636
37+
Sequence diagram
38+
39+
![Half-Sync/Half-Async sequence diagram](./etc/half-sync-half-async-sequence-diagram.png)
40+
3741
## Programmatic Example of Half-Sync/Half-Async Pattern in Java
3842

3943
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.
Loading

health-check/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ In plain words
3030

3131
> 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.
3232
33+
Sequence diagram
34+
35+
![Health Check sequence diagram](./etc/health-check-sequence-diagram.png)
36+
3337
## Programmatic Example of Health Check Pattern in Java
3438

3539
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.
Loading

hexagonal-architecture/README.md

-4
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,6 @@ Running the main function of App class produces the following output:
173173

174174
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.
175175

176-
## Detailed Explanation of Hexagonal Architecture Pattern with Real-World Examples
177-
178-
![Hexagonal Architecture class diagram](./etc/hexagonal.png)
179-
180176
## When to Use the Hexagonal Architecture Pattern in Java
181177

182178
Hexagonal Architecture is particularly beneficial in scenarios:

0 commit comments

Comments
 (0)