Skip to main content

Posts

Showing posts from June 10, 2016

Design Patterns in Java

Design pattern are basic building block to efficiently design application as per requirement.
Broadly we divide it into 3 categories. CreationalStructuralBehavioral.

Creational
SingletonPrototypeFactoryFactory methodabstract factoryBuilder

Creational

Creational pattern are based upon strategy we apply to control creation of object.
If we want to create object which can't be created again we call it singleton. Its like resource which we don't want be duplicated like connection.we make constructor private to achieve our objective.


Below patterns comes under Creational design pattern.



Structural (A,B,C,D,F,F,P)
Adapter,bridge,Composite, Decorator, Facade,Flyweight, Proxy

Behavioural (MM,II,SS,CC,TV,O)



Command, Chain of responsibility,Mediator, Memento,Iterator, Interpreter,Strategy,State, Template, Visitor, Observer


J2EE Design Patern (Apart from GORM)

MVC ,Front controller , DAO , Service locator , Business delegate



Sample Code:


package com.java.singleton;
public class DemoSingleton {     private…