What is a design pattern?#
Design patterns were made to tackle common problems that arise within software design and software development when working with real-world app development. Design patterns are like customizable templates that can be applied to your code regardless of your preferred programming language. While they aren’t meant to be directly copied and pasted into your code, they provide you with high-level conceptual information that can help you solve your software design problems.
The same design pattern won’t look the same when applied to two different programs. This is where the customization comes in. You can think of a design pattern as a blueprint, providing you a high-level plan to guide you through your software design process, but giving you the power to implement the solution in a way that best fits your needs.
Note: Design patterns are different from algorithms. Algorithms clearly define a set of steps to help you solve a problem, while design patterns provide high-level descriptions.
Why use design patterns?#
There are many benefits to using design patterns within your software development environment. Some benefits include:
- They provide you with a set of dependable solutions to common problems
- They help you learn the fundamentals to solving problems
- They give you and your team a way to communicate with one another more efficiently
- They provide you with pre-made templates that you can customize according to your needs
- They are easy to maintain because they mitigate the variability that arises with system requirements
There are 23 Gang of Four (GoF) patterns that are considered the foundations for all other design patterns. They are separated into three main groups based on three common problem areas within software architecture: behavioral, creational, and structural.