From the course: JavaScript: Patterns
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Mediator pattern - JavaScript Tutorial
From the course: JavaScript: Patterns
Mediator pattern
- [Emmanuel] The mediator pattern provides a set of objects which interact with each other, mostly by having a central authority dictating the terms in between objects. It is best demonstrated with example code. Take a look at the exercise files, and pull the files from this video. You'll see here an example that is often used to demonstrate the mediator pattern. So basically what we have here is first a class called TrafficTower, so we're creating a tower, and inside of that tower we have a list of all the airplanes. And then we can actually request all the positions of the airplanes from that TrafficTower. And then we have a class called Airplane, and we're basically building a constructor with the position and trafficTower, and so on and so forth. And then we have a function that requests positions from the traffic tower. So basically the airplane can actually track itself from the traffic tower and then the…
Contents
-
-
-
-
-
- (Locked) What are behavioral patterns?1m 4s
- (Locked) Observer pattern2m 36s
- (Locked) State pattern3m 6s
- (Locked) Chain of responsibility1m 30s
- (Locked) Iterator pattern3m 44s
- (Locked) Strategy pattern1m 36s
- (Locked) Memento pattern53s
- (Locked) Mediator pattern1m 32s
- (Locked) Command pattern2m 24s
- (Locked)
-