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
From Simple Factory to Factory Method: Evolution of a Design Pattern
In our previous discussion of the Simple Factory pattern, we created a single factory that produced different types of products. Today, we'll explore how this evolves into the Factory Method pattern.
Imagine our business has grown, and instead of having one factory that produces multiple types of vehicles, we now want specialized factories, eac ...
Posted on Thu, 25 Jun 2026 17:11:38 +0000 by yurko
Mastering Creational Design Patterns in Java: Factory, Prototype, and Builder Approaches
Instantiation logic often becomes tightly coupled with business requirements when objects are created directly using the new keyword. Modifying these dependencies later requires widespread code changes, violating the Open/Closed Principle. Creational design patterns abstract the object creation process, centralizing initialization logic and enh ...
Posted on Mon, 15 Jun 2026 17:02:33 +0000 by kcengel
Creational Factory Design Patterns: Simple, Method, and Abstract
Classifications of Factory Patterns
Simple Factory
Factory Method
Abstract Factory
Pattern Details and Implementations
Simple Factory
A Simple Factory encapsulates object creation within a single class. Clients rely on a parameter passed to the factory to determine which concrete product subclass to instantiate, while interacting with the pro ...
Posted on Wed, 27 May 2026 17:37:02 +0000 by jamz310
Implementing the Factory Method Design Pattern for Extensible Object Creation
Addressing Extensibility with the Factory Method Software systems requiring future extensibility must adhere to the Open-Closed Principle. When a module needs to perform operations without knowing the exact implementation details upfront, object creation must be decoupled from the core logic. The Factory Method pattern resolves this by deferri ...
Posted on Thu, 07 May 2026 20:57:52 +0000 by zerGinfested