Xpode.com        Click here to Print this article.

JAVA/J2EE INTERVIEW QUESTIONs:- Explain many types of design pattern?


Factory design pattern:-Defines an interface for creating an object , but lets the sub class decide which class to instantiate.

Abstract factory design pattern:-Provides an interface for creating families of related or dependant  objects without specifying their concrete classes.

Relation between factory and abstract factory pattern:- When factory pattern is applied to a family of products and an interface is provided for the same,abstract design pattern is formed.

Adaptar design pattern:-
•Converts interface of a class into interface that client expects
•Allows classes to work together which could otherwise not be possible

Builder design pattern and its advantages: - Moves the construction logic of the object from the object class to a builder classImproves.
•Object construction
•Making new changes
•Modular design

Command design pattern:- Encapsulates a request as object and supports parametrizing other objects.

Composite design pattern:- describes that a group of objects are to be treated in the same way as a single instance of an object.

Decorator design pattern: - 
•responsibilities to an object added dynamically
•provide a flexible alternative to sub classing for extending functionality

Facade design pattern: -
•Provides a unified interface to a set of interfaces in a sub system
•Defines higher level interface that makes sub system easier to use

Flyweight design pattern:- An object that minimizes memory use by sharing as much data as possible with other similar objects.

Mediator design pattern: - 
•Define an object that encapsulates details and other objects interact with such object
•The relationships are loosely decoupled

Observer design pattern:- Defines one to many dependency between objects so that when one object changes state all its dependants are notified and updated automatically.

Prototype design pattern:- Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.

Singleton design pattern:- Ensures a class has only one instance and provides a global point  access to it.

State design pattern:- Allows an object to change its behavior when its internal state changes.

Template design pattern:- 
•Defines skeleton of algorithms in a method deferring some steps to sub classes
•Allows sub classes to redefine some steps without changing the algorithm

Memento design pattern:- Deals with storing and retrieving objects as and when required.

Also see the following video on Java Builder Design Pattern as follows:- 


Regards,
Get more on Java interview questions from authors blog.



http://
http://

Contributed by:
Shivprasad koirala Koirala
I am a Microsoft MVP for ASP/ASP.NET and currently a CEO of a small E-learning company in India. We are very much active in making training videos , writing books and corporate trainings. Do visit my site http://www.questpond.com for .NET, C# , design pattern , WCF , Silverlight , LINQ , ASP.NET , ADO.NET , Sharepoint , UML , SQL Server training and Interview questions and answers

Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=643

Click here to go on website