Factory Kit Pattern
Factory and Builder and super popular design patterns and still relevant and useful. However what happens if you need to allow others to create objects? That’s like a reverse factory where the user needs to define the creational rules. So how can we do that and also have some guardrails and fences to drive some control and even some abstractions, is that possible? yes — that’s the factory-kit pattern. Hold one a second why the heck I would need that? Let’s say you are creating a game or a modular solution and you need to allow you consider defining customizations within some constraints.
The Video
The Code
Cheers,
Diego Pacheco
Originally published at http://diego-pacheco.blogspot.com on October 29, 2021.