Behavioral Design Pattern: Mediator Pattern in Aircraft Control Systems
Aircraft Control System Scenario
Consider an aircraft control system involving airplanes, control towers, and ground services.
class Airplane {
private ControlTower tower;
private GroundService service;
public Airplane(ControlTower t, GroundService g) {
this.tower = t;
this.service = g;
}
public void reques ...
Posted on Sat, 15 Aug 2026 16:52:50 +0000 by maxudaskin
Implementing Factory and Mediator Patterns for a Tower Defense Game
The Attack method in BotanicRepeater retrieves a bullet via the mediater:
@Override
public void attack(ICharacter target) {
Bullet projectile = Mediator.getInstance().fetchBullet("SingleBullet", launchPoint, new Point(1300, launchPoint.y));
}
In BotanicRepeaterFactory, create a plant character using the factory method:
@Override
...
Posted on Sun, 19 Jul 2026 16:27:04 +0000 by dalex
Java Design Patterns: Visitor and Mediator Patterns
Visitor Pattern
The Visitor Pattern is a behavioral design pattern that allows you to add new operations to existing object structures without modifying the structures themselves. This pattern is particularly useful when you need to perform various operations on a collection of objects that have different interfaces.
The key components of the ...
Posted on Wed, 15 Jul 2026 17:18:11 +0000 by Pyro4816