Tag Archives: gang-of-four

Singleton Pattern

According to Gang of Four Ensure a class only has one instance, and provide a global point of access to it. According to Wikipedia The singleton pattern is a design pattern that restricts the instantiation of a class to one object. So we can explain singleton pattern as follows: A singleton is a class. That class should have only one instance in… Read More »

Factory Method Pattern

According to Gang of Four: Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.  According to Wikipedia “The factory method pattern uses factory methods to deal with creating objects without specifying the exact class of object that will be created. This is done… Read More »