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ä committed 2025-04-06 15:52:26 +03:00
1 parent 203548ec03
commit 30d13083ae
18 files changed
+36 -12

No files matched your search

+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