Posts

Showing posts from December 24, 2010

Creational Patterns in java

Creational Patterns in java:- Definition:- Ceartional Patterns is designed for making the object of any class with best possible ways.  So that application can manage the heap memory allocation area. Creational design patterns solve this problem by somehow controlling this object creation. There are some example of Creational Patterns. Abstract factory pattern Factory method pattern Builder pattern Lazy initialization pattern Object pool pattern Prototype pattern Singleton pattern

Creational Patterns : Factory pattern

Creational Patterns : factory pattern in Java:- Definition:- Factory pattern is comes under the creational pattern. In the Factory pattern, There is a class which manage the creation of object according to the situation is called factory.     There is an example which describe the Factory pattern. public class course {    private int courseCode;    private String CourseName;    public int getCourseCode() {        return courseCode;    }    public void setCourseCode(int courseCode) {        this.courseCode = courseCode;    }    public String getCourseName() {        return CourseName;    }    public void setCourseName(String courseName) {        CourseName = courseName;    } } public class Java extends course {    // some code here } public class Php extends course {    // some code here } public class CourseFactory {    public course getCourse(String courseName) {        if (courseName.equals("Java")) {            re

Design Patterns in Java

Design Patterns in Java:- Definition:- In java point of views, Design patterns is the arrangement of Java classes. A design pattern is a solution to a general software problem within a particular context . Context : A recurring set of situations where the pattern applies. Problem : A system of forces (goals and constraints) that occur repeatedly in this context. Solution : A description of communicating objects and classes (collaboration) that can be applied to resolve those forces. In Java design pattern is three types. Creational Patterns Structural Patterns Behavioural Patterns Concurrency pattern

Recent Post

Recent Posts Widget