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 -4
View File
@@ -33,6 +33,10 @@ Wikipedia says
> In object-oriented programming, delegation refers to evaluating a member (property or method) of one object (the receiver) in the context of another original object (the sender). Delegation can be done explicitly, by passing the sending object to the receiving object, which can be done in any object-oriented language; or implicitly, by the member lookup rules of the language, which requires language support for the feature.
Sequence diagram
![Delegation sequence diagram](./etc/delegation-sequence-diagram.png)
## Programmatic Example of Delegation Pattern in Java
Let's consider a printing example.
@@ -114,10 +118,6 @@ Canon Printer:hello world
Epson Printer:hello world
```
## Detailed Explanation of Delegation Pattern with Real-World Examples
![Delegate class diagram](./etc/delegation.png "Delegate")
## When to Use the Delegation Pattern in Java
* When you want to pass responsibility from one class to another without inheritance.
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB