Jack of All Trades

30 Apr 2020

The Blueprint

The beauty of design patterns is the versatility of its usage. It is never a finished design that overcomes one problem but rather a template of how to solve problems for many situations. These patterns are for commonly occurring problems in software engineering that creates a systematic way of solving a particular problem. This is not to be confused with functions or algorithms which can be copied into your program or give you a clear set of instructions of what to do. Rather, design patterns help allow you to systematically approach problems to find a solution. An amazing analogy used by Refactoring Guru is as follows:

An analogy to an algorithm is a cooking recipe: both have clear steps to achieve a goal. On the other hand, a pattern is more like a blueprint: you can see what the result and its features are, but the exact order of implementation is up to you.

The benefits of learning these patterns is that you can use commonly known terms such as Factory, Singleton, Observer, or Model-View Controller (MVC) to communicate with other devlopers. Short explanations for these are:

The Club and its Members

Before learning about design patterns, I was blinded by the fact that it was being used in my projects throughout my software engineering course. However, after learning about it, it becomes clear how relevant it is to my current project, more specifically, Observers. With Observers, it helps design a general problem of objects interacting with another. This is relevant in the Mongo Database where we publish and subscribe data. When we subscribe to a data, we want to follow any changes or updates made to the publisher. Making this more relevant to my current project with CL-UH-B, which consist of Singletons, Observers, and MVC. On a page, we will subscribe to our collection of clubs allowing the page to load the data and display it to the user. If the user is an admin, they can interact with this data in a frontend manner which allows them to easily make modifications to their specific club. Since multiple pages are subscribed to the publisher, when that admin made that update, all subscribing pages were updated along with it. This is useful because instead of changing each page one-by-one, the admin can easily go to one page, make an edit, and update it so that anyone viewing it will be able to see it. So where was it present?: