The Foundations of Programming

03 Dec 2020

Design patterns are an important aspect of coding. Design patterns act as a template to base your code off of. These various patterns allow someone to easily find a solution to problems that fit the characteristics of a design pattern. This way, someone doesn’t need to reinvent the wheel each time they stumble upon a problem; they just need to look for these patterns and find similar solutions that fit the problem they are having with the code. These design patterns basically make up the foundations to build code off of and allow people to easily find and solve problems.

Without even noticing, I have been using some design patterns since most of my code has been based on the various templates that were supplied to me. Probably one of the most important ones that I’ve used in the final project is the publish-subscribe design pattern that was described in the screencast. The publish-subscribe design pattern in my code allows me to publish a certain schema and have my pages subscribe to these databases that are attached to those schemas. This design pattern allows me to save and publish the data that fills and populates the various web pages on the campus cravings website. Another design pattern I used was also the singleton design pattern that was also described in the screencast. In the website, I had to create many different schema that attaches to various different collections. There are a few instances where I had to point to these collections within certain pages, so it was very useful to have this singleton design pattern to have this global value to point to in order to easily access my collections.