DEV Community

Discussion on: Design patterns. How do you select yours?

Collapse
 
tomowens profile image
Thomas J Owens

A few passages from the Gang of Four Design Patterns book stand out.

From the Preface:

Design patterns capture solutions that have developed and evolved over time. Hence they aren't the designs people tend to generate initially. They reflect untold redesign and recoding as developers have struggled for greater reuse and flexibility in their software.

From Chapter 1 (Introduction):

Each design pattern systematically names, explains, and evaluates an important and recurring design...Our goal is to capture design experience in a form that people can use effectively.

Knowing the appropriate design patterns for the context in which you are working is a good thing. But patterns are, in my opinion, first and foremost a communication tool. You can have a good design without knowingly using any patterns. However, understanding patterns and information about things like the intention, motivation, and participants and their responsibilities allow you to talk about and understand other people's designs, which can help you improve your designs.

At the end of the day, though, focus on good design principles, not trying to use patterns. As you read about other people's designs along with the problems they were trying to solve and the tradeoffs they made, you'll come across various "patterns".