Introduction to Design Patterns

Aqua Education
Web Architects
Published in
2 min readAug 7, 2023

On your path to becoming an architect, it’s super important for you to get familiar with design patterns. You may think that you don’t have a lot of chances to use design patterns in your day-to-day work. But the reality is, if you have been coding for a few years, you must have used some sort of design patterns directly or indirectly. Design patterns are everywhere. You may have used them in your own code without realizing that, or they might be in the framework you use to build your app. Getting a good understanding of design patterns will bring you many benefits. Here, I list two benefits that I think are most important.

  • Design patterns are ubiquitous in all kinds of libraries, frameworks, and languages (e.g., the Java.io package uses the decorator pattern). If you figure out what design patterns are used in these libraries, frameworks, and languages and the rationale behind them, you gain a deeper insight into them and you write better code that incorporates more best practices.
  • Design patterns are based on Object-Oriented design. Exposure to more design patterns will give you a better understanding of OOD, which leads to a better-quality codebase.

Learning design patterns can be very challenging. There are many well-known design pattern books out there. Two on top of my recommendation list are

  • Design Patterns — Elements of Reusable Object-Oriented Software
  • Agile Software Development, Principles, Patterns, and Practices

Reading design pattern books can be very dry and confusing in the beginning. Here I provide some tips for learning design patterns that I personally find very helpful.

  • Read the books and at the same time pay attention to the code you get exposed to in your daily work. It doesn’t need to be the code you write, it can be the source code of a library or framework you are using. Finding real-world examples of a design pattern will significantly improve your understanding of that design pattern.
  • Of course, you need to apply the design patterns you’ve learned to your code as much as possible. But don’t abuse design patterns. Use them when there are real benefits. Don’t use a design pattern for the sake of using it.
  • Some design patterns can be really hard to wrap your head around the first time you read them. Don’t get frustrated, try to read the chapter a second time, and even a third time. You will gain a better understanding each time you read it.

--

--