Skip to content

Commit 79a4483

Browse files
committed
Updated UMLs
1 parent 76f721c commit 79a4483

File tree

22 files changed

+737
-69
lines changed

22 files changed

+737
-69
lines changed

Behavioral Patterns/chain-of-responsibility/README.md

+26-2
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,33 @@ To see the Chain of Responsibility Pattern in action, refer to the [`Main.java`]
5252

5353
## 📊 UML Diagram
5454

55-
Here’s the UML representation of the Chain of Responsibility Pattern:
55+
```mermaid
56+
classDiagram
57+
direction TB
58+
class Client {
59+
}
5660
57-
![Chain of Responsibility UML](./chain-of-responsibility_uml.png)
61+
class Handler {
62+
+handleRequest()
63+
}
64+
65+
class ConcreteHandler1 {
66+
+handleRequest()
67+
}
68+
69+
class ConcreteHandler2 {
70+
+handleRequest()
71+
}
72+
73+
Handler <--o Handler : successor
74+
Client --> Handler : " send command "
75+
Handler <|-- ConcreteHandler1
76+
Handler <|-- ConcreteHandler2
77+
78+
79+
```
80+
> [!NOTE]
81+
> If the UML above is not rendering correctly, you can view the diagram from the [`singleton_uml.png`](./singleton_uml.png) file.
5882
5983
---
6084

Behavioral Patterns/command/README.md

+32-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,38 @@ To see the Command Pattern in action, refer to the [`Main.java`](./Main.java) fi
3434

3535
## 📊 UML Diagram
3636

37-
Here’s the UML representation of the State Pattern:
38-
39-
![Command UML](./command_uml.png)
37+
```mermaid
38+
classDiagram
39+
direction LR
40+
class Client {
41+
}
42+
43+
class Invoker {
44+
}
45+
46+
class Command {
47+
+Execute()
48+
}
49+
50+
class ConcreteCommand {
51+
-state
52+
+Execute()
53+
}
54+
55+
class Receiver {
56+
+Action()
57+
}
58+
59+
Client --> Invoker
60+
Invoker o--> Command
61+
Command <|-- ConcreteCommand
62+
ConcreteCommand --> Receiver : receiver
63+
Client --> Receiver
64+
Client --> ConcreteCommand
65+
66+
```
67+
> [!NOTE]
68+
> If the UML above is not rendering correctly, you can view the diagram from the [`command_uml.png`](./command_uml.png) file.
4069
---
4170

4271
## 📝 Key Takeaways

Behavioral Patterns/iterator/README.md

+32-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,38 @@ To see the Iterator Pattern in action, refer to the [`Main.java`](./Main.java) f
5151

5252
## 📊 UML Diagram
5353

54-
Here’s the UML representation of the Iterator Pattern:
55-
56-
![Iterator UML](./iterator_uml.png)
54+
```mermaid
55+
classDiagram
56+
class Aggregate {
57+
+CreateIterator()
58+
}
59+
60+
class ConcreteAggregate {
61+
+CreateIterator()
62+
}
63+
64+
class Iterator {
65+
+First()
66+
+Next()
67+
+hasNext()
68+
}
69+
70+
class ConcreteIterator {
71+
+First()
72+
+Next()
73+
+hasNext()
74+
}
75+
76+
Client --> Iterator
77+
Client --> Aggregate
78+
Aggregate <|-- ConcreteAggregate
79+
Iterator <|-- ConcreteIterator
80+
ConcreteAggregate --> ConcreteIterator : constructs
81+
ConcreteIterator --> ConcreteAggregate : has (traverses)
82+
83+
```
84+
> [!NOTE]
85+
> If the UML above is not rendering correctly, you can view the diagram from the [`iterator_uml.png`](./iterator_uml.png) file.
5786
5887
---
5988

Behavioral Patterns/mediator/README.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,39 @@ Key features:
2626
---
2727

2828
## 📊 UML Diagram
29+
```mermaid
30+
classDiagram
31+
direction LR
32+
class Mediator {
33+
+mediate()
34+
}
2935
30-
![Mediator UML](./mediator_uml.png)
36+
class ConcreteMediator {
37+
+mediate()
38+
}
39+
40+
class Colleague {
41+
+operation()
42+
}
43+
44+
class ConcreteColleagueA {
45+
+operationA()
46+
}
47+
48+
class ConcreteColleagueB {
49+
+operationB()
50+
}
51+
52+
Mediator <|-- ConcreteMediator
53+
Colleague <|-- ConcreteColleagueA
54+
Colleague <|-- ConcreteColleagueB
55+
Colleague --> Mediator : mediator
56+
ConcreteMediator --> ConcreteColleagueA
57+
ConcreteMediator --> ConcreteColleagueB
58+
59+
```
60+
> [!NOTE]
61+
> If the UML above is not rendering correctly, you can view the diagram from the [`mediator_uml.png`](./mediator_uml.png) file.
3162
3263
---
3364

Behavioral Patterns/observer/README.md

+31-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,37 @@ To see the Observer Pattern in action, refer to the [`WeatherStation.java`](./We
4242

4343
## 📊 UML Diagram
4444

45-
Here’s the UML representation of the Observer Pattern:
46-
47-
![Observer UML](./observer_uml.png)
45+
```mermaid
46+
classDiagram
47+
class Subject {
48+
-observers : Observer
49+
+Attach()
50+
+Detach()
51+
+Notify()
52+
}
53+
54+
class Observer {
55+
+Update()
56+
}
57+
58+
class ConcreteSubject {
59+
-state
60+
+GetState()
61+
}
62+
63+
class ConcreteObserver {
64+
-subject : ConcreteSubject
65+
+Update()
66+
}
67+
68+
Subject <|-- ConcreteSubject
69+
Subject o--> Observer
70+
Observer <|-- ConcreteObserver
71+
ConcreteSubject --> ConcreteObserver
72+
73+
```
74+
> [!NOTE]
75+
> If the UML above is not rendering correctly, you can view the diagram from the [observer_uml.png](./observer_uml.png) file.
4876
4977
---
5078

Behavioral Patterns/state/README.md

+26-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,32 @@ To see the State Pattern in action, refer to the [`TestDrive.java`](./TestDrive.
4141

4242
## 📊 UML Diagram
4343

44-
Here’s the UML representation of the State Pattern:
45-
46-
![State UML](./state_uml.png)
47-
44+
```mermaid
45+
classDiagram
46+
direction LR
47+
class Context {
48+
+request()
49+
}
50+
51+
class State {
52+
+handle()
53+
}
54+
55+
class ConcreteStateA {
56+
+handle()
57+
}
58+
59+
class ConcreteStateB {
60+
+handle()
61+
}
62+
63+
Context o--> State
64+
State <|-- ConcreteStateA
65+
State <|-- ConcreteStateB
66+
67+
```
68+
> [!NOTE]
69+
> If the UML above is not rendering correctly, you can view the diagram from the [state_uml.png](./state_uml.png) file.
4870
---
4971

5072
## 📝 Key Takeaways

Behavioral Patterns/strategy/README.md

+30-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,36 @@ To see the Strategy Pattern in action, refer to the [`Main.java`](./Main.java) f
5454

5555
## 📊 UML Diagram
5656

57-
Here’s the UML representation of the Strategy Pattern:
58-
59-
![Strategy UML](./strategy_uml.png)
57+
```mermaid
58+
classDiagram
59+
direction LR
60+
class Client {
61+
}
62+
63+
class Context {
64+
-strategy : Interface
65+
}
66+
67+
class Interface {
68+
+algorithm()
69+
}
70+
71+
class ImplementationOne {
72+
+algorithm()
73+
}
74+
75+
class ImplementationTwo {
76+
+algorithm()
77+
}
78+
79+
Client --> Context
80+
Context o--> Interface
81+
Interface <|-- ImplementationOne
82+
Interface <|-- ImplementationTwo
83+
84+
```
85+
> [!NOTE]
86+
> If the UML above is not rendering correctly, you can view the diagram from the [strategy_uml.png](./strategy_uml.png) file.
6087
6188
---
6289

Behavioral Patterns/template-method/README.md

+28-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,34 @@ To see the Template Method Pattern in action, refer to the [`Main.java`](./Main.
4040

4141
## 📊 UML Diagram
4242

43-
Here’s the UML representation of the Template Method Pattern:
44-
45-
![Template Method UML](./template-method_uml.png)
43+
```mermaid
44+
classDiagram
45+
class Client {
46+
}
47+
48+
class AbstractClass {
49+
+TemplateMethod()
50+
+primitiveOperation1()
51+
+primitiveOperation2()
52+
}
53+
54+
class ConcreteClass1 {
55+
+primitiveOperation1()
56+
+primitiveOperation2()
57+
}
58+
59+
class ConcreteClass2 {
60+
+primitiveOperation1()
61+
+primitiveOperation2()
62+
}
63+
64+
Client --> AbstractClass
65+
AbstractClass <|-- ConcreteClass1
66+
AbstractClass <|-- ConcreteClass2
67+
68+
```
69+
> [!NOTE]
70+
> If the UML above is not rendering correctly, you can view the diagram from the [`template-method_uml.png`](./template-method_uml.png) file.
4671
4772
---
4873

Behavioral Patterns/visitor/README.md

+48-3
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,54 @@ To see the Visitor Pattern in action, refer to the [`Main.java`](./Main.java) fi
5656

5757
## 📊 UML Diagram
5858

59-
Here’s the UML representation of the Visitor Pattern:
60-
61-
![Visitor UML](./visitor_uml.png)
59+
```mermaid
60+
classDiagram
61+
direction LR
62+
class Client {
63+
}
64+
65+
class ObjectStructure {
66+
}
67+
68+
class Element {
69+
+Accept(Visitor)
70+
}
71+
72+
class ElementA {
73+
+Accept(v: Visitor)
74+
}
75+
76+
class ElementB {
77+
+Accept(v: Visitor)
78+
}
79+
80+
class Visitor {
81+
+VisitElementA(ElementA)
82+
+VisitElementB(ElementB)
83+
}
84+
85+
class ConcreteVisitor1 {
86+
+VisitElementA(ElementA)
87+
+VisitElementB(ElementB)
88+
}
89+
90+
class ConcreteVisitor2 {
91+
+VisitElementA(ElementA)
92+
+VisitElementB(ElementB)
93+
}
94+
95+
Client --> ObjectStructure
96+
Client --> Visitor
97+
ObjectStructure --> Element
98+
Element <|-- ElementA
99+
Element <|-- ElementB
100+
Element --> Visitor
101+
Visitor <|-- ConcreteVisitor1
102+
Visitor <|-- ConcreteVisitor2
103+
104+
```
105+
> [!NOTE]
106+
> If the UML above is not rendering correctly, you can view the diagram from the [`visitor_uml.png`](./visitor_uml.png) file.
62107
63108
---
64109

0 commit comments

Comments
 (0)