What is a Design Pattern?


What is a Design Pattern?

What is a Design Pattern?

Design Patterns, in Turkish "Tasarım Kalıpları," are highly optimal code templates developed by people to solve problems encountered in the programming language we write code in.

Design patterns make our jobs as developers easier in many fields, from gaming to mobile applications and even web design, and help produce solutions to software problems we encounter or assist us in the solutions we will create.

The foundations of Design Patterns emerged in 1970, but they became popular with the book "GoF Design Patterns" published by the Gang of Four in 1994, which covers 23 design patterns.

Today, there are far more than 23 patterns, and in fact, if you create your own solution to a problem and make it as optimal as possible and use it in more than one project, you have actually created your own design pattern.

Why Do We Need Design Patterns?

  • Design Patterns can speed up the development process by providing tested, proven development paradigms.
  • They help keep your code simpler, making code more meaningful and less complex when needed. 
  • They help prevent subtle issues that can cause major problems and also increase code readability.
  • A standard solution process for a common programming problem allows software to be reused on a large scale.

Categorizing Design Patterns

Design patterns are divided into 3 categories according to the title of the problems they solve, these are;
  • Creational Patterns: These are patterns used in the creation and management of objects. They provide flexibility and convenience in creating whatever object is needed during program flow.
  • Structural Patterns: These are patterns used to determine how multiple classes will behave when performing a task together. 
  • Behavioral Patterns: These are patterns that organize the relationships between objects.

Examples of Design Patterns

Creational Patterns

  • Singleton Pattern
  • Factory Pattern
  • Abstract Factory Pattern
  • Builder Pattern
  • Prototype Pattern

Structural Patterns

  • Adapter Pattern
  • Bridge Pattern
  • Filter Pattern
  • Composite Pattern
  • Decorator Pattern
  • Facade Pattern
  • Flyweight Pattern
  • Proxy Pattern

Behavioral Patterns

  • Command Pattern
  • Interpreter Pattern
  • Iterator Pattern
  • Mediator Pattern
  • Memento Pattern
  • Observer Pattern
  • Null Object Pattern
  • Strategy Pattern
  • State Pattern
  • Visitor Pattern