Skip to main content
Share Your Experience: Take the 2024 Developer Survey

For questions requesting extra attention to be paid to the usage of design patterns in the code.

Use this tag to indicate that you would like extra attention to be paid to the usage of design patterns in the code.

Remember that on Code Review, we look only at concrete code, so questions that present a design style in abstract form will be summarily closed.

A design pattern is a description or template that helps solve a reoccurring problem, which can be used in many different situations.

It is common to classify design patterns into the following categories:

  • Creational design patterns deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. The basic form of object creation could result in design problems or added complexity to the design. Creational design patterns solve this problem by somehow controlling object creation.
  • Structural design patterns ease the design by identifying a simple way to realize relationships between entities.
  • Behavioral design patterns identify common communication patterns between objects and realize these patterns. By doing so, these patterns increase flexibility in carrying out this communication.
  • Concurrency patterns deal with the multi-threaded programming paradigm.

Related to design patterns, are architectural patterns. These are often concepts which solve and delineate some essential cohesive elements of a software architecture.

Wikipedia Article for Design Patterns

'Before' and 'After' refactoring examples