Many times software developers fall into same type of problems. So instead of finding solution from scratch, can we use the same / similar type of solution which was given by other engineers earlier? Yes, it is possible to use the same solution in case of similar type of problem.
So design pattern is like having pattern of same problem and solution has been already defined / given. Its like If you want to learn how to drive a car? then some predefined steps have been already provided and you need to follow the same steps and off course, based on your car, there may be some difference like manual gear or automated gear etc. but ground rule will always remain same. Similar things goes with software also.
There are mainly 3 types of software design patterns are available.
- Creational design patterns
- Behavioral design patterns
- Structural design patterns
There are many design patterns which are fall under each type.
Advantages of using design pattern:
- Proven solution
- No need to find solution from scratch
- Time saving
Disadvantages of design patterns:
- If you will select wrong design pattern for your problem then you will fall into problem. You must know why you are using a design pattern and how it will solve your problem.