Design Patterns
To understand anything new in technology, these are 3 main question one should always ask, i.e., What, Why and How?
WHAT -> What it is?
WHY -> Why should we use it?
HOW -> How should we use it?
So, lets understand the design pattern based on same 3 questions?
1. What is Design Pattern? What does it mean?
Ans: Design patterns are simply as word says it is a pattern in which certain design is made/approached.
In technical world, they are the reusable solutions to the common problems that occur in software design.
2. Why we should use Design Pattern?
Ans: The idea to use design pattern is to speed up the development process by providing well-tested, proven software paradigms. Design pattern helps you to make your code more flexible, reusable and maintainable. Every design pattern has its goal and you should know which one to pick and implement based on the problem in project.
To just give an example, we all mostly come across or worked on database connection, we can't create database connection object every time we need it. As it can be costly. So, to tackle or avoid a situation, by not letting user create multiple database connection we can use singleton design pattern
To understand How? Firstly, we need to understand which are the types of design pattern. We need to go one by one to understand the how part.
Below is the hierarchy level representation of Design Patterns:
Design Pattern Hierarchy |
No comments:
Post a Comment