Similar patterns and how to tell them apart
From CSSEMediaWiki
Revision as of 00:33, 27 September 2009 by JaninaVoigt (Talk | contribs)
This page is for gathering information about design patterns that are similar in some way with information on how to distinguish between them. In particular, some patterns look very similar but can be distinguished because their purposes are different, while other patterns have similar purposes but are different in terms of their structure. Hopefully, this will be helpful for our exam study.
Facade and Mediator
These two patterns have very similar purposes in that they both attempt to abstract communications between objects. They are different because:
- For the Facade pattern, clients don't know that they are talking to a facade rather than the actual subsystem it abstracts. For Mediator the objects communicating through the mediator are aware that they are communicating with a mediator rather than with the other colleagues directly.
- In the Facade pattern, the facade communicates with the subsystem but the subsystem knows nothing about the facade so the communication / knowledge is one-way only. In the Mediator pattern, the mediator knows about and communicates with the colleagues and the colleagues know about and communicate with the mediator so communication / knowledge is two-way.