In the previous chapter, we have explained how Java Design Pattern helps software developers. This chapter explains about Java Design Pattern and its types.
There are three types of Java Design Patterns, they are:
Creational Design Pattern.
Structural Design Pattern.
Behavioral Design Pattern.
Creational pattern, Behavioral pattern and Structural pattern are sub divided into different patterns.
Creational Pattern deals with object creation and is mainly used to make a decision while creating an object for a class. Creational pattern controls the creation of object.
Creational Pattern is divided into 6 patterns:
Factory Method Pattern.
Abstract Factory Pattern.
Object Pool Pattern.
Singleton Pattern can increase the memory and efficiency of an object. Only one instance can be created for singleton pattern.
Prototype Pattern is used for object cloning and can create a duplicate object.
Factory Method Pattern
Factory Method Pattern is used to create instances for derived classes.
Abstract Factory Pattern
Abstract Factory Pattern can create instances for family of classes.
Builder Pattern is used to separate the construction of an object from its representation.
Object Pool Pattern
Object Pool Pattern can enhance the performance of the system by recycling the unused objects.
Behavioral Pattern allows objects to interact in a much better way. The interactions must be loosely coupled so that they communicate with each other. Behavioral Pattern is divided into 12 patterns, they are:
Chain Of Responsibility Pattern.
Structural patterns can be used to identify the relationship between various structures. Structural pattern focuses on how classes are inherited from one another. Structural Pattern is again divided into 7 patterns, they are:
Java Design Pattern are mostly used in Software Designing.
Design and analysis iterations can be reduced using Java Design Pattern.