Design pattern

Design Pattern: Singleton

The singleton is a design pattern used when it is needed to have one and only one object of a certain class.

As the singleton instance can be accessed from anywhere in a system, this design pattern can be used to coordinate actions, or to replace global variables.

design pattern singleton

Design Pattern: Factory

The Factory is a design pattern used when it is needed to create objets without having to specify the exact class to implement. We only know need to know the general usage of the implemented class, not the internal operations.

That’s why a Factory return objets who are either :
- from a class extending a known abstract class,
- or from a class implementing a known interface.


Design Pattern: Factory