Design patterns provide a coding standard if we will strictly follow it our code undergo less modification,we will face less bugs and we will take less time for development or modification.
There are three types of design patterns: 1. Creational : Deals with object creation/instantiation. 2. Structural : Deals with structure of class design. Like how pollymorphism and inheritance can be used. 3. Behavioral : Deals with interaction of different objects. Loose coupling and high cohesion.
Following are the major design pattern examples
When to Use: We use this pattern when we have multiple algorithms for doing something. For example: I want to go to airport and lets think I have two option - take an auto or book a cab. In both the cases I will do one thing but I can take different options.