Strategy Design Pattern

This is kind of Behavioral Design Pattern(BDP) and as per the BDP definition, “Behavioral patterns describe how the objects behave when they interact with each other” and this design pattern is used when we have number of options to choose our strategy among available strategies. Example: Lets say you have one List of Employees which you want to sort based on your demand. So the Employee class … Continue reading Strategy Design Pattern

Command Design Pattern

This is kind of Behavioral Design Pattern(BDP) and as per the BDP definition, “Behavioral patterns describe how the objects behave when they interact with each other” and as the name explain this design pattern is used when we give command to some one else to get our job done. Example: When you visit any restaurant, you place an order to waiter not to cook and its … Continue reading Command Design Pattern

Chain of Responsibility Design Pattern

This is kind of Behavioral Design Pattern(BDP) and as per the BDP definition, “Behavioral patterns describe how the objects behave when they interact with each other“. So this design pattern is used when the job is done in pieces and those pieces interact with each other at run time. E.g.  Controller -> Validator -> Service -> DAOImpls. So as you know, Controllers are the entry … Continue reading Chain of Responsibility Design Pattern

A Beginner’s Guide to Design Patterns

We use design patterns so that we don’t have to write repeated code again and again for same kind of problem. Design pattern is not a class or piece of code. Its a template which should be implemented based on the situation. Design patterns are divided into following categories:- Behavioral, Creational, Structural Behavioral pattern: As the name explain, Behavioral patterns describe how the objects behave … Continue reading A Beginner’s Guide to Design Patterns