Table of Contents
Open Table of Contents
The other day I was watching videos on YouTube, and suddenly I came across an interesting one called “8 Design Patterns every Developer should know” by NeetCode (he creates content about programming. Check his channel).
So, I decided to write a set of posts about these design patterns and write the examples in Go (NeetCode writes them in Python). If you have ever written some code in Go, you may know that OOP patterns aren’t common in this language. However, I still believe they have their usage depending on the scenario or task we need to solve.
What is a design pattern?
A design pattern is a general repeatable solution to a commonly occurring problem in software design. It is a proven solution to a particular task/problem, which you can use to solve similar problems in different contexts.
What are the benefits of using a design pattern?
- Common language: Design patterns provide a common language for developers to describe and communicate solutions to recurring problems.
- Design principles: Design patterns promote excellent design principles such as abstraction, modularity, and encapsulation, which make code more maintainable, reusable, and easier to understand.
- Categorization: We can group them into several categories, such as creational, structural, and behavioral patterns. Each pattern provides a specific way of solving a problem and has advantages and disadvantages.
- Time and effort savings: Using design patterns can save time and effort in software development by providing well-established solutions to common problems.
What design patterns are we going to learn?
As I mentioned, we’ll explore eight different designs patterns, and are the following:
- Singleton (Yes, no kidding)
Even though there are many more design patterns, I found this list as a good starting point. After this set of posts, we could explore more of them.
In the next post, we’ll start with the first design pattern: Factory, so stay tuned!