Total WebSite Views Count

Singleton Design Pattern Alternatives

Singleton Design Pattern Alternatives

We can use Singleton pattern while creating objects of thread pools, caches etc to avoid wasting resources. If you want to store global information like item price of products etc. It’s now a anti-pattern and you should avoid it by different substitutes.
Important Note: It has now become Anti-design pattern and we should avoid by using following techniques:
1. Dependency Injection
2. Using Factory design Pattern
3. Using Enum class etc. (Introduced in Java 1.5)
1
2
3
4
5
// Enum singleton - the preferred approach 
 
public enum MySingleton{
 INSTANCE Consolas, Monaco, monospace;
}

AWS Services

AWS Services

Technology Selection & Evaluation Criteria

Technology Selection & Evaluation Criteria

Scale Cube - Scale In X Y Z Cube

Scale Cube - Scale In X Y Z Cube

Feature Post

AWS Services

About Me

About Me

Spring Cloud

Spring Cloud
Spring Cloud

Spring Cloud +mCloud Native + Big Data Archittect

Spring Cloud +mCloud Native + Big Data Archittect

ACID Transaction

ACID Transaction

Data Pipe Line Stack

Data Pipe Line Stack

Popular Posts