Skip to content

Commit 25f7bc6

Browse files
committed
docs: balking, bloc, bridge diagrams
1 parent 9ca63fc commit 25f7bc6

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

balking/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ Wikipedia says
2929

3030
> The balking pattern is a software design pattern that only executes an action on an object when the object is in a particular state. For example, if an object reads ZIP files and a calling method invokes a get method on the object when the ZIP file is not open, the object would "balk" at the request.
3131
32+
Flowchart
33+
34+
![Balking flowchart](./etc/balking-flowchart.png)
35+
3236
## Programmatic Example of Balking Pattern in Java
3337

3438
This example demonstrates the Balking Pattern in a multithreaded Java application, highlighting state management and concurrency control. The Balking Pattern is exemplified by a washing machine's start button that initiates washing only if the machine is idle. This ensures state management and prevents concurrent issues.

balking/etc/balking-flowchart.png

47.9 KB
Loading

bloc/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ The Bloc pattern manages the state of an object and allows for dynamically notif
3535

3636
> While not a formalized "Gang of Four" design pattern, Bloc is widely used in state-driven applications. It centralizes state management and propagates state changes to registered observers, following principles of separation of concerns.
3737
38+
### Sequence diagram
39+
40+
![Bloc sequence diagram](./etc/bloc-sequence-diagram.png)
41+
3842
---
3943

4044
## Programmatic Example of the Bloc Pattern in Java

bloc/etc/bloc-sequence-diagram.png

29.2 KB
Loading

bridge/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ Wikipedia says
3636

3737
> The bridge pattern is a design pattern used in software engineering that is meant to "decouple an abstraction from its implementation so that the two can vary independently"
3838
39+
Sequence diagram
40+
41+
![Bridge sequence diagram](./etc/bridge-sequence-diagram.png)
42+
3943
## Programmatic Example of Bridge Pattern in Java
4044

4145
Imagine you have a weapon that can have various enchantments, and you need to combine different weapons with different enchantments. How would you handle this? Would you create multiple copies of each weapon, each with a different enchantment, or would you create separate enchantments and apply them to the weapon as needed? The Bridge pattern enables you to do the latter.
@@ -203,10 +207,6 @@ The hammer is unwielded.
203207
The item's glow fades.
204208
```
205209

206-
## Bridge Pattern Class Diagram
207-
208-
![Bridge](./etc/bridge.urm.png "Bridge class diagram")
209-
210210
## When to Use the Bridge Pattern in Java
211211

212212
Consider using the Bridge pattern when:
26.2 KB
Loading

0 commit comments

Comments
 (0)