Diving into Design Patterns

28 Apr 2022

A Professional Design Pattern

Something we all eventually have to deal with in life is figuring out how and where we want to get a job. Jobs differ in what they require, but typically they agree on some common formalities before getting hired for the job. This includes submitting a resume / cover letter and conducting an interview of sorts, along with some other things as well. Specifically, design patterns are applicable to resumes and cover letters that you may submit to employers. Typically, when you make resumes, you make a general resume that displays your experience, skills, and whatever else you may feel the need to let the employer know. After that, you add in certain things to customize the resume in order to direct the resume specifically towards the job that you are applying for. By creating the general resume, you are essentially following a design pattern, which is a reusable solution to a common problem in the case of software engineering. In this case, the general resume would be that reusable solution, and the common problem would be getting a job.

Design Patterns In Software Engineering

As I mentioned previously, a design pattern is a solution to a problem that can be repeated but have some different variations each time. In this class, we have examples of design patterns, and the most prominent one I can think of is the meteor-application-template-react template that we have used for many different exercises and activities in this class. By itself, it is not a solution to any particular problem, but it is the foundation that leads to solutions for problems that we have encountered in this class. It is essentially the initiator we need to solve the problems we run into.

One example of this is for our final project where we are tasked with creating a web application that users related to the UH community can benefit from. In the case of my group, we decided to make (Peer Review Finder)[https://peer-review-finder.github.io/], which allows graduate students specifically to connect and find peer reviewers for their papers. With the meteor-application-template-react template, we were able to have a foundation to start with as we created and constructed our web application. Design patterns also typically allow for variation as each problem is not the same. The template allows for that too, as you can add different code for different functionalities, thus making it the base for many possible solutions to different problems.

The Observer

As shown in the design patterns diagram above, we can see that there are many different design patterns in software engineering. One that I have experienced in some fashion is the observer design pattern. The observer design pattern is where we have one main entity that other entities are observing, meaning they are dependent on that main entity. When this main entity encounters any state changes, the entity will notify all of its observer entities to be updated accordingly. One example I can think of that applies to the Observer design pattern is meteor. Meteor has this reactivity feature where if you are running your web application locally by using a command like ‘meteor npm run start’, whenever changes are made, the web app is automatically refreshed as a result. This acts as an observer design pattern as the main entity is changed and then the rest of the entities update accordingly. Wherever the change is made to is the main entity, the dependent entities are updated via the auto refresh update after the changes are made. This functionality that Meteor has essentially captures the essence of what the observer design pattern is all about.