What is a Design Pattern?

29 Nov 2023

How I see Design Patterns

A simple way to describe design patterns is that it is a solution that you can use for a recurring problem in your coding process. Design patterns are so useful because they will save time when you are solving problems in your code. Depending on the size of your program, you will most likely have many problems that can be solved with the same solution, so why not find a pattern that works to solve that problem multiple times? One design pattern that you use will not solve every single problem that you have, but it can help take away the stress of trying to solve the same problem over and over again. In doing so, it allows you to put more brain power into the bigger problems of whatever you are working on.

What Can I Compare it to

If you can imagine yourself building a tower, it would be nice to have a blueprint for how to build it. This is basically what a design pattern is. It would not make sense to build each building from scratch. It would make more sense to have a blueprint that you can use repeatedly to build a bunch of buildings. This allows you to add other things to each building to each of them to make them unique from each other. But, the whole idea is that you have the building to add things to rather than trying to remember how to build it.

My Experience with Design Patterns

I have only recently found out about design patterns. But looking at what design patterns there are, I have used many of these design patterns in past projects. One of them is the singleton pattern, most especially from projects I have done in this class. Since the pages we make get pointed to rather than another instance of it being made, this is an example of using a singleton pattern. I have also used an observer pattern when working with databases. If something in a database gets modified, everything that uses that data has to change based on what was changed. I would not say that design patterns are useless, but I feel like they kind of just come naturally and you do not really need to study them. This is just my opinion however, but I have apparently been using design patterns the whole time I have ever started coding and I only just recently found out about them as a concept.