Questions of Test: GOF Design pattern


Creates an instance of several derived classes. Define an interface for creating an object, but let subclasses decide which class to instantiate. It eliminates the need to bind application specific classes into your code This is a creational pattern


Creates an instance of several families of classes. Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
This is a creational pattern


Separates object construction from its representation. Separate the construction of a complex object from its representation so that the same construction processes can create different representations.
This is a creation pattern


Match interfaces of different classes.Convert the interface of a class into another interface clients expect. It lets classes work together that couldn't otherwise because of incompatible interfaces.
This is a structural pattern


A fine-grained instance used for efficient sharing. Use sharing to support large numbers of fine-grained objects efficiently. A shared object that can be used in multiple contexts simultaneously. 
String class has been designed with this pattern.
This is a structural pattern.


Defines simplified communication between classes. Define an object that encapsulates how a set of objects interact. It promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.
One of the negative about this pattern is that it could lead to one complex class and hard to maintain.
It is a behavioral pattern


An object representing another object. Provide a surrogate or placeholder for another object to control access to it.
Used heavily by Spring 


Defer the exact steps of an algorithm to a subclass. Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Lets subclasses redefine certain steps of an algorithm without changing the algorithm?s structure.
Used By Spring in JDBC Template , JPA Template


A way of notifying change to a number of classes. Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically
This is a behavioral pattern


Encapsulates an algorithm inside a class. Define a family of algorithms, encapsulate each one, and make them interchangeable. It lets the algorithm vary independently from clients that use it. 
It is a behavioral pattern.