Design Patterns

 Design patterns are typical solutions to commonly occurring problems in software design. They are like pre-made blueprints that you can customise to solve a recurring design problem in your code.

The pattern is not a specific piece of code, but a general concept for solving a particular problem. You can follow the pattern details and implement a solution that suits the realities of your own program.

Why we need to know Design Patterns :


Design patters, in lament terms , are a  structure of code that provides efficiency, resistance to code stinks and provide a way of cleaner code.

When a group of software designers communicate, they need not say the entire structure of the code. They just point out the name of the design pattern and it is understandable for the rest of the designers.

For example :

There is a design pattern called Singleton Design Pattern. If its used , only one object can be created for the class.This is made by declaring a private constructor to class.

During design discussions, the designer need not to say, we have to use private constructor and create the object with getInstance() method. The designers just says , we can go with the singleton design pattern.

Types of Design Patterns :


  • Creational patterns provide object creation mechanisms that increase flexibility and reuse of existing code.
    • Factory Method
    • Abstract Factory
    • Singleton
    • Builder
    • Prototype
  • Structural patterns explain how to assemble objects and classes into larger structures, while keeping the structures flexible and efficient.
    • Adapter
    • Bridge
    • Composite
    • Decorator
    • Flyweight
    • Facade
    • Proxy
  • Behavioural patterns take care of effective communication and the assignment of responsibilities between objects.
    • Chain of Responsibility
    • Mediator
    • Observer
    • Iterator
    • Command
    • Momento
    • State
    • Strategy
    • Template
    • Visitor

Comments