Перейти к содержанию

About Design Patterns

Definition

Design patterns are typical solutions to common problems in software design. Each pattern is like a blueprint that you can customize to solve a particular design problem in your code.

Benefits of patterns

Patterns are a toolkit of solutions to common problems in software design. They define a common language that helps your team communicate more efficiently.

Pattern classification

  1. Creational patterns worry about the flexible creation of objects without introducing unnecessary dependencies into the program.
  2. Structural patterns show different ways of building relationships between objects.
  3. Behavioral patterns take care of efficient communication between objects.

Design principles

The qualities of good architecture:

  1. Code reuse.
  2. Extensibility.

Basic design principles:

  1. Encapsulate what is changing. Identify the aspects of a program, class, or method that change most often, and separate them from what remains constant.
  2. Program at the interface level, not at the implementation level. The code should depend on abstractions, not specific classes.
  3. Prefer composition to inheritance.