Nagarro interview question

Advantages and Disadvantages of Singleton Design Pattern

Interview Answer

Anonymous

24 Apr 2021

Singleton pattern can be implemented interfaces. It can be also inherited from other classes. It can be lazy-loaded. It has Static Initialization. It can be extended into a factory pattern. Unit testing is more difficult (because it introduces a global state into an application). This pattern reduces the potential for parallelism within a program because to access the singleton in a multi-threaded system, an object must be serialized (by locking).