Recognizing the Patterns

03 Dec 2020

What is the Pattern?

“Wait, you can have designs in patterns? Or patterns in design? I’m confused”. These are the first thoughts that I had when I found out that we will be covering design patterns. To be completely honest, when I first seen the words “design pattern”, I immediately thought of intricate visual designs such as plaid or paisley (Obviously I was completely wrong). After diving deeper into the topic, I realized it was nowhere near what I was expecting it to be (No visual designs? Bummer!). As I was going through the different types of design patterns, I was becoming more confused. There was a lot to go over, and each design pattern had their own specific use, which for some reason I could not wrap my head around. After reviewing the different patterns, I realized that it is much simpler than I was making it out to be, it’s basically a developed template made to address a problem! The way I like to think of this is like building a computer. There are many parts to a computer, but all have a similar outcome when put together, they make a functional and usable computer. Design patterns are like the parts. There are parts that help solve the processing of data, parts that solve the problem of storing memory, and parts that handle the problem of powering on the computer. These are all parts developed by someone-else, and so our job is to just put the computer together following the design pattern of each part.

Patterns are Everywhere!

So, then you might ask, where are these patterns? How are they implemented? How often are they used? They are used everywhere and every day, and it turns out that I have even been using design patterns in my code without even realizing it. From the moment I started learning about Meteor and React I was being subconsciously taught how to implement design patterns. Just by using MongoDB, I have been using the Observer design pattern, which is an object that maintains a list of its dependents, which will help keep the data being stored up to date if there have been any changes in either the server or the client side. Another design pattern that I have unknowingly implemented into my coding is the Singleton design pattern, which in many of my programs throughout the semester, have helped me access and manipulate certain data collections that have been stored into MongoDB. An example of Singleton design pattern that I am currently using in my current in-progress-application is a “Reviews” collection that stores reviews made by users of our application. An instance of the object is then stored so that it may be returned to admin-level users as analytical data that can be used to improve the website. This helped me understand design patterns a lot better, and when I finally discovered how they were being implemented in my own code I realized what these patterns can be useful for… solving many frustrating problems!

The Infinite Design Pattern

Despite the confusion that I had experienced; I have learned so much about how useful design patterns are. They provide efficient ways to implement different components of code and integrate them all into one functional system, making software engineering a lot simpler and easier to understand. And for me the best part is that we do not have to figure out these design patterns; we just have to figure out which patterns are best for certain situations and implement them! Overall, I will continue to apply my knowledge of design patterns not only to my code, but to my future as well. I’d like to think of my journey of becoming a software engineer as the problem, and by implementing my own experiences as design patterns into my life and addressing certain moments and challenges, I will eventually reach my goal and solve that problem!