What is Design Pattern ?
Introductionπ€π§ π‘
I found myself repeatedly questioning, "What is a design pattern, and why I should use it ? ".
The professor said that using design patterns makes our code more readable, cleaner, and easier to maintain. Despite my efforts, the concept remained abstract and unclear.
A concise and insightful quote by Christopher Alexander, well-known architect, who pioneered the concept of design patterns, clarified the idea for me. He explained that
'Each design pattern can describe an issue which happens again and again in our surrounding. Then, it also describes about the fundamental solution to that problem. In this way, you can use this solution a million times over, without every doing it the same way twice.'
This quote helped to illuminate my understanding of design patterns, enabling me to better grasp their importance and application.
Who created design pattern ?
Christopher Alexander, the father of design pattern - an architect, built design pattern for
building architectures in 1977.
Later in 1995, design patterns for software designs were created by 4 software designers & engineers - Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, known as "Gang of Four". They wrote a book named "Design Patterns: Elements of Reusable Object-Oriented Software" which include 23 design patterns for Object Oriented Software Design.
My Definition of Design Pattern
Let's define design pattern as a blue print that is reusable to solve common problems that many programmers may definitely face in handling a program. Using design pattern cannot solve your coding errors or bugs, but it can provide a conceptual structure of your program which is easily understandable, reusable, and easily maintainable.
Is that all reasons why I should use design pattern ?
Yes exactly. Let me give you an example. ☝
In real world projects, hundreds or thousands of classes or codes have to be written. Moreover, when we work with a group of developers team, each needs to understand code written by others.
I would amend it to say, 'Fixing a software bug, only to later forget how you fixed it, is even more challenging.'
Nowadays, many programming languages provide frameworks that follow specific design patterns. Therefore, when using a framework, it is not necessary to implement a design pattern from scratch. However, understanding the concepts behind design patterns can give you a deeper insight into how the framework works. On the other hand, if you are working with a pure programming language such as PHP, Python, or Java, applying design patterns can significantly improve the maintainability and scalability of your project—especially in large team-based or corporate projects.
x
Comments
Post a Comment