docs: add diagrams for decorator, delegation, dependency injection, dirty flag, domain model, double buffer, double-checked locking, double dispatch, and dynamic proxy

This commit is contained in:
Ilkka Seppälä
2025-04-06 15:52:26 +03:00
parent 203548ec03
commit 30d13083ae
18 changed files with 36 additions and 12 deletions
+4
View File
@@ -29,6 +29,10 @@ Wikipedia says
> In software engineering, double-checked locking (also known as "double-checked locking optimization") is a software design pattern used to reduce the overhead of acquiring a lock by testing the locking criterion (the "lock hint") before acquiring the lock. Locking occurs only if the locking criterion check indicates that locking is required.
Flowchart
![Double-Checked Locking flowchart](./etc/double-checked-locking-flowchart.png)
## Programmatic Example of Double-Checked Locking Pattern in Java
The Double-Checked Locking pattern is used in the `HolderThreadSafe` class to ensure that the `Heavy` object is only created once, even when accessed from multiple threads. Here's how it works:
Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB