Designing the Environment

27 Apr 2022

Getting to Know Design Patterns

At first, I thought design patterns were what we use to draw out or design something in arts and crafts. How can we make something look nice? What can catch someone’s attention and make it appealing? But I discovered that on the higher level, it is a whole new dimension. According to Christopher Alexander, a design pattern describes some sort of problem in our environment that occurs many times, but we can come up with a solution that can be used over and over, without doing it the same way twice. A solution might work well in one place, but not in another. We can use design patterns to solve the problem that occurs in different environments with different methods.

Designing Our Code

We can see this a lot in our daily programming. There is an issue we need to try and solve, but there are many ways to approach it. We should recognize these design patterns so that we can make our code more structured and prevent it from becoming a huge mess. Our code can be more versatile and help reach different environments. We can also see design patterns in game development, and the games itself. I enjoy open-world games and I always put a lot of effort into designing my characters and equipping myself with gear I find along the way. Players want to find different items, weapons, and attributes that work with their playstyle and their particular builds. Knowing how all the items and gear work together help players come up with their own strong and creative builds.

In programming, learning about design patterns can help us to move our code up to the next level. Maybe there is another way to code a particular section? Instead of all these if/else statements, maybe we can use a switch function? Maybe we can condense this down and make it simpler? When we open up our eyes to different solutions, we can go to a higher level in developing our programs. One design pattern that relates to this characteristic is the singleton pattern. The singleton pattern is simple and quick to deploy, which can save us time when we deploy our systems. This pattern also provides a “global state” in an object-oriented manner.

In My World

I now see that a lot of work and what I do, is filled with design patterns. For our final project, Warrior Cravings, we will be using the observer design pattern. We will filter and cater towards what the user inputs. Based on the user’s data, such as what they like or what they want to eat for that day, we take that data to recommend top choices or filter the vendors and food items accordingly. This design pattern allows us to observe the user and follow what they want and enjoy.

Design patterns can be like blueprints that help others navigate and maintain the code we have written. Someone might like what we came up with, but the person might not be able to read or interpret our code. More issues will pop up and it will be harder to catch errors. Our code should be able to speak for itself, why we chose a certain approach and what our intentions are.

In the future, I want to travel more often but I also want to apply everything I learned. I believe design patterns are definitely something that I want to remember. Everywhere I go, there are bound to be issues that need to be solved. I will need to find the approach that would best fit that environment and something that I can use to solve a similar issue elsewhere, but the effect will be different.