Mediator Pattern
We mentioned Mediator Pattern when we look at Front-end Controller Pattern from the MVC. The Front-end Controller is a web application pattern which "provides a centralized entry point for handling requests".
Mediator Pattern Definition
Mediator Pattern Definition
"The mediator pattern defines an object that encapsulates how a set of objects interact. This pattern is considered to be a behavioral pattern due to the way it can alter the program's running behavior."
Analog To Real world
Analog To Real world
An airport control tower is an excellent example of the mediator pattern. The tower looks after who can take off and land - all communications are done from the airplane to control tower, rather than having plane-to-plane communication.
Implementation in Java API
Resources:
http://en.wikipedia.org/wiki/Mediator_pattern
http://java.dzone.com/articles/design-patterns-mediator
Implementation in Java API
- java.util.Timer (all schedule methods)
- java.util.concurrent.Executor#execute()
- java.util.concurrent.ExecutorService (the invokeXXX() and submit() methods)
- java.util.concurrent.ScheduledExecutorService (all scheduleXXX() methods)
- java.lang.reflect.Method#invoke()
Resources:
http://en.wikipedia.org/wiki/Mediator_pattern
http://java.dzone.com/articles/design-patterns-mediator
评论
发表评论