An Introduction of Design Patterns - BEHIND JAVA

An Introduction of Design Patterns

Share This

Design patterns are solutions to general problems that software developers faced during software development. Design patterns are proven solutions approaches to specific problems. A design pattern is not a framework and is not directly deployed via code. Design Pattern have two main usages:

  • Common language for developers: They provide developers a common language for certain problems. For example if a developer tells another developer that he is using a Singleton, the another developer (should) know exactly what this means.
  • Capture good practices: Design patterns capture solutions which have been successfully applied to problems. By learning these patterns and the related problem, an unexperienced developer learns a lot about software design.

History of Design Pattern

In 1994, four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides published a book titled Design Patterns - Elements of Reusable Object-Oriented Software which initiated the concept of Design Pattern in Software development. These authors are collectively known as Gang of Four (GOF). According to these authors design patterns are primarily based on the following principles of object orientated design.

  • Program to an interface not an implementation
  • Favor object composition over inheritance

Design Patterns Splitup

Design Patterns can be classified in three categories: Creational, Structural and behavioral patterns. Here follows the Design Patterns comes under each categories.

Creational Design Patterns- These design patterns provides way to create objects while hiding the creation logic, rather than instantiating objects directly using new opreator. This gives program more flexibility in deciding which objects need to be created for a given use case. Here follows the design patterns comes under this category

  • Singleton Pattern
  • Factory Pattern
  • Abstract Factory Pattern
  • Builder Pattern
  • Prototype Pattern

Structural Patterns- These design patterns concern class and object composition. Concept of inheritance is used to compose interfaces and define ways to compose objects to obtain new functionalities.

  • Adapter Pattern
  • Composite Pattern
  • Proxy Pattern
  • Flyweight Pattern
  • Facade Pattern
  • Bridge Pattern
  • Decorator Pattern
Behavioral Design Patterns- These design patterns are specifically concerned with communication between objects.

  • Template Method Pattern
  • Mediator Pattern
  • Chain of Responsibility Pattern
  • Observer Pattern
  • Strategy Pattern
  • Command Pattern
  • State Pattern
  • Visitor Pattern
  • Iterator Pattern
  • Memento Pattern

No comments:

Post a Comment

Pages