Java Design Pattern Overview

  • Facebook
  • Google
  • LinkedIn
  • Twitter

A design pattern is used for solving the specific/common problem during the software development. This is just like a template for how to solve the common problem that can be used in many different situations. Using the design pattern application code will be more flexible, reusable and maintainable.

Advantages of Java design pattern:

  1. These are reusable.
  2. These are the defined solutions to general re occurring problems so it reduces time of application development.
  3. These are defined solution so any new or experience developer understands and debugs easily.
  4. These provide the best solutions that help to define the system architecture.
  5. These provide the communication between the developers.
  6. These provide clearness to the design of an application.
  7. These describe how the classes and objects interact in the application.
  8. These capture expert knowledge and make expertise widely available.

Here are mainly three types of design pattern.

Creational Design patterns: It is used to create an object instances in the best way because everyone know that object instance is created in Java using a new keyword but this is hard coding approach which is not good in the programming language

Student student = new Student ();

Using creational design patterns objects is created but hides the creation logic, rather than instantiating objects directly using new operator and this approach gives more flexibility in deciding which objects need to be created for a given use case.

Here are types of Creational Design patterns.

  1. Factory Pattern
  2. Abstract Factory Pattern
  3. Singleton Pattern
  4. Prototype Pattern
  5. Builder Pattern.

Structural Design patterns: Structural Patterns refers to the best design of instances and classes in a structured manner. It describes how objects can be associated and composed to form larger, more complex structures.

Here are types of Structural Design patterns:

  1. Adapter Pattern
  2. Bridge Pattern
  3. Composite Pattern
  4. Decorator Pattern
  5. Facade Pattern
  6. Flyweight Pattern
  7. Proxy Pattern

Behavioral Design patterns: Java Behavioral Patterns is concerned of interaction between java instances. You know in n-tire application loose coupling is the key area of application design. Behavioral Patterns is the industry`s best practice to design the communication channel between instances and their dependencies this means the implementation and the client should be loosely coupled in order to avoid hard coding and dependencies.

Here are types of Behavioral Design patterns:

  1. Chain Of Responsibility Pattern
  2. Command Pattern
  3. Interpreter Pattern
  4. Iterator Pattern
  5. Mediator Pattern
  6. Memento Pattern
  7. Observer Pattern
  8. State Pattern
  9. Strategy Pattern
  10. Template Pattern
  11. Visitor Pattern
For more details please see
Head First Design Patterns