Skip to content

Commit 07ca3a9

Browse files
committed
update readme
1 parent 1567863 commit 07ca3a9

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

BehavioralPatterns/Mediator/README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,23 @@ The Mediator is commonly used to coordinate related GUI components.
3030
* Single point of failure
3131
* Hard to test --> Objects should be mocked
3232

33+
## Common Structure
34+
35+
![Common structure of mediator pattern](https://upload.wikimedia.org/wikipedia/commons/9/92/W3sDesign_Mediator_Design_Pattern_UML.jpg)
36+
37+
* Mediator (IChatRoom)
38+
* defines an interface for communicating with Colleague objects
39+
* ConcreteMediator (ChatRoom)
40+
* implements cooperative behavior by coordinating Colleague objects.
41+
* knows and maintains its colleagues.
42+
* Colleague (IParticipant)
43+
* defines an interface for using Colleague objects.
44+
* ConcreateColleague (Participant)
45+
* each colleague knows its Mediator object
46+
* each colleague communicates with its mediator whenever it would have otherwise communicated with another colleague.
47+
48+
_[Source: http://www.dofactory.com/net/mediator-design-pattern]_
49+
3350
## Example
3451

3552
![Mediator Pattern](/Diagrams/Mediator.png)
@@ -119,21 +136,4 @@ IParticipant galileo = new Participant("Galileo", chatRoom);
119136

120137
newton.Send(galileo.GetName(), "I discoverd laws of motion");
121138
einstein.Send(newton.GetName(), "I discovered how gravity works");
122-
```
123-
124-
## Common Structure
125-
126-
![Common structure of mediator pattern](https://upload.wikimedia.org/wikipedia/commons/9/92/W3sDesign_Mediator_Design_Pattern_UML.jpg)
127-
128-
* Mediator (IChatRoom)
129-
* defines an interface for communicating with Colleague objects
130-
* ConcreteMediator (ChatRoom)
131-
* implements cooperative behavior by coordinating Colleague objects.
132-
* knows and maintains its colleagues.
133-
* Colleague (IParticipant)
134-
* defines an interface for using Colleague objects.
135-
* ConcreateColleague (Participant)
136-
* each colleague knows its Mediator object
137-
* each colleague communicates with its mediator whenever it would have otherwise communicated with another colleague.
138-
139-
_[Source: http://www.dofactory.com/net/mediator-design-patternttp://www.dofactory.com/net/adapter-design-pattern]_
139+
```

0 commit comments

Comments
 (0)