Design Pattern: Singleton Pattern in Java
Singleton pattern is used to ensure that, only one instance of a class can be created. This article demonstrates Singleton pattern implementations in Java.
Design Pattern Tutorials
Singleton pattern is used to ensure that, only one instance of a class can be created. This article demonstrates Singleton pattern implementations in Java.
Using the Factory pattern we generate objects based on some criteria. In Abstract factory pattern, we use multiple factory pattern implementations and generate objects based on that. Abstract factory pattern is also called Factory of Factory, so before reading about Abstract factory pattern, take a look at the Factory pattern.
Design Patterns are solutions to common/general problems while designing software. In this article we are discussing what design patterns are, the type and use-cases.
Factory pattern is one of the most popular and commonly used patterns. When we don’t know what is the type of object that is going to be generated then we use the Factory pattern to create objects based on some criteria.
Singleton pattern is used to ensure that only one instance of a class is created in any case, and whenever you want to get an instance of that class, then the same object instance is returned.