Test yourself under real exam conditions: 50 timed questions, 60 on the clock, pass mark 70%%. Instant score with a full review of everything you got wrong. Free — no account needed.
Exam details
Design patterns are reusable solutions to commonly occurring problems in software design. They were popularized by the Gang of Four (GoF) in their 1994 book. They are not code, but templates for solving problems that can be adapted to many situations.
Benefits:
The three categories are:
The Singleton pattern ensures a class has only one instance and provides a global point of access to it.
Key traits:
public static Singleton getInstance() { if (instance == null) instance = new Singleton(); return instance; }
Singleton drawbacks include:
The Factory Method defines an interface for creating objects but lets subclasses decide which class to instantiate.abstract class Creator {
abstract Product factoryMethod();
}
Benefits: