Skip to content

Commit 32c9031

Browse files
committed
docs: diagrams for version number, virtual proxy, visitor
1 parent 81ecb56 commit 32c9031

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

Diff for: version-number/README.md

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

3636
> The Version Number pattern is a technique used to manage concurrent access to data in databases and other data stores. It involves associating a version number with each record, which is incremented every time the record is updated. This pattern helps ensure that when multiple users or processes attempt to update the same data simultaneously, conflicts can be detected and resolved.
3737
38+
Flowchart
39+
40+
![Version Number Pattern Flowchart](./etc/version-number-flowchart.png)
41+
3842
## Programmatic Example of Version Number Pattern in Java
3943

4044
Alice and Bob are working on the book, which stored in the database. Our heroes are making changes simultaneously, and we need some mechanism to prevent them from overwriting each other.

Diff for: version-number/etc/version-number-flowchart.png

73.4 KB
Loading

Diff for: virtual-proxy/README.md

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

3636
> A proxy that controls access to a resource that is expensive to create.
3737
38+
Sequence diagram
39+
40+
![Virtual Proxy Sequence Diagram](./etc/virtual-proxy-sequence-diagram.png)
41+
3842
## Programmatic Example of Virtual Proxy Pattern in Java
3943

4044
The Virtual Proxy design pattern in Java can optimize resource utilization and system performance.

Diff for: virtual-proxy/etc/virtual-proxy-sequence-diagram.png

49.7 KB
Loading

Diff for: visitor/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ Wikipedia says
3232

3333
> In object-oriented programming and software engineering, the visitor design pattern is a way of separating an algorithm from an object structure on which it operates. A practical result of this separation is the ability to add new operations to existing object structures without modifying the structures.
3434
35+
Sequence diagram
36+
37+
![Visitor sequence diagram](./etc/visitor-sequence-diagram.png)
38+
3539
## Programmatic Example of Visitor Pattern in Java
3640

3741
Consider a tree structure with army units. Commander has two sergeants under it and each sergeant has three soldiers under them. Given that the hierarchy implements the visitor pattern, we can easily create new objects that interact with the commander, sergeants, soldiers, or all of them.
@@ -221,10 +225,6 @@ Program output:
221225
14:58:06.118 [main] INFO com.iluwatar.visitor.CommanderVisitor -- Good to see you commander
222226
```
223227

224-
## Detailed Explanation of Visitor Pattern with Real-World Examples
225-
226-
![Visitor](./etc/visitor_1.png "Visitor")
227-
228228
## When to Use the Visitor Pattern in Java
229229

230230
Use the Visitor pattern when

Diff for: visitor/etc/visitor-sequence-diagram.png

33.3 KB
Loading

0 commit comments

Comments
 (0)