Each pattern is like a blueprint that you can customize to solve a particular design problem in your code.
This creates a set of related objects or dependent objects.
- An abstract factory pattern acts as a super-factory that creates other factories.
- An abstract factory interface is responsible for creating a set of related objects or dependent objects
without specifying their concrete classes.
Basically, think in terms of abstracting the methods and properties of a UML diagram
interface Door {
getDescription(): void;
}
class WoodenDoor implements Door
{
public function getDescription() {
console.log("I am a wooden door");
}
}
An existing (partially or fully constructed design) is a prototype.
public Analytics {
private static _instance: Analytics;
private Analytics() { }
public static getInstance(): Analytics {
if (!Analytics._instance)
Analytics._instance = new Analytics();
return Analytics._instance;
}
}