What is a Design Pattern?

Learn about design patterns in general.

A design pattern is a general repeatable solution to a typical problem in software design. Design patterns are similar to premade blueprints that we can tweak to resolve a recurring design issue in our code. In simple terms, design patterns are conventional answers to common software design challenges.

Pros and cons of design patterns

Let’s learn about the advantages and disadvantages of design patterns.

Pros of using design patterns

  • Design patterns let us write better code more quickly and have much less impact on analysis, testing, and documentation phases.
  • Design patterns are used to solve problems and are reusable in multiple projects.
  • When implemented correctly, design patterns improve benchmark performance and makes the code more readable.

Cons of using design patterns

  • It may be tempting to use design patterns for problems that might be better solved without them.
  • Design patterns can make simple code more complicated.
  • Design patterns sometimes reduce the performance of the code.

Selecting the right design pattern to use for our problem depends on our goals and the outcome we want. Two or more design patterns often have the same outcome, but knowing which one to use comes with experience rather than overengineering our codebase.

Get hands-on with 1200+ tech skills courses.