Reflect On Design Patterns

05 Dec 2017

When you hear the word pattern, what is the first word or idea that comes to mind? For me, the word pattern breeds the idea of music. Music is basically a culmination of sounds and patterns that express feelings or thoughts. Every person’s sound is different, special, yet usually references a pattern that’s similar to their art. You can kind of think of this as a genre. Patterns help guide the design and creation of the work, which in music, allows the artist to follow a path for their sound. The patterns help give a sort of mathematical approach to an abstraction. In programming, it’s the same. Design patterns provide a guide that helps programmers create a solution based off their knowledge and experience. Just as how patterns are mathematical, design patterns have a systematic approach to figuring out a problem. I’ve described patterns and compared them to genres of music. Just as there’s an endless number of genres, there are countless different design patterns that can be used to achieve a goal. And just how each genre has their unique quality that can produce its own distinct sound, design patterns are used for their own special reason. Although I am a fan of many music genres, I’m not the most diverse person when it comes to design patterns. One design pattern I have become familiar with is the Observer design pattern. In our Manoarecipes project, we contain many collections that have dependents that change when notified. Whenever the user wants to update or remove a recipe, the collection is informed to change its list. This is similar to the Observer scheme, which allows us to efficiently maintain our collections of our ingredients, users, recipes, etc. Design patterns are an essential role when approaching complicated problems that may have recognizable algorithmic schemes.