Giants Before Me

03 Dec 2020

“I stand on the shoulders of giants before me…” a clique, I know. Many leaders and many greats have used this line in speeches; I am pretty sure I have even heard presidents use it. My 5th grade teacher also taught me to never start an essay with a quote so that is two fouls in one opening sentence, but this clique is so suiting of a reflection on design patterns that it feels like a must. It is thanks to the work of countless before us that we have come so far in software engineering, computer science as a whole, and most aspects of humanity – but that is a different discussion entirely. Design patterns is one such example of generations inheriting knowledge and in this discussion I refer to it in the context of software engineering. At this point in my computer science journey, I am just learning what design patterns are, but I can already appreciate how I have used many of them without even knowing it.

For the layman, a popular analogy for design patterns (and algorithms) is baking. I love to bake and have done so for most of my life. I am only a home baker so I know my way around a stand mixer, but I am by no means “Greatest British Home Baker”. I am just a big fan of the show. With that being said, when it comes time to bake a 3-tiered Japanese-style Strawberry Shortcake – I refer to a recipe. I love the cake itself and I enjoy baking so I will often opt for making it myself but you won’t catch me making it up as I go – I refer to a recipe. When tasked with a problem that has been handled by many before us, it makes sense to at least start with a tried and true recipe. Strawberry shortcake, Abstract Factories, MVC, it is all the same. They are recipes for handling problems already solved by people who know what they are doing. Even when they are not the entire answer to a particular problem, they are a great start. Sometimes I get a little adventurous and I want different texture for my shortcake, so I modify the recipe a little to fit my needs. Sometimes we want a slight variation of a Model-view-controller, so we modify it to suit our needs. We follow design patterns in software engineering for the same reasons why many attend university or at least self study CLRS Introduction to Algorithms. Rather than start completely from scratch, we learn the foundation established by centuries of mathematicians, physicists, engineers, computer scientists, and many other scholars.

It could be argued that a con of following design patterns is that it may limit one’s ability to innovate. By following the logic of institutionalized design patterns, it may cloud one’s ability to think outside the box and build something completely different – possibly better. We follow what we believe to be fundamental laws, but few things are absolutes and even fundamentals can be completely flipped once we begin to question the norms. Not too long ago, spontaneous generation was believed to be how flies appeared from food. Questioning this belief through the scientific process led us to learn that flies do not appear from nothing, but rather follow food sources. Even with this in mind, it makes sense to at least begin with design patterns, they were built from the cumulative knowledge and experiences of countless before us. Both the Japanese and American style Strawberry Shortcake are divergent evolutions of the traditional European shortcake. The shortcake is a variation of traditional vanilla cakes, biscuits, and so on and so forth. Current design patterns are built on older generations of beliefs and we have continued to evolve our practices as we learn or even stumble upon breakthroughs. With all that being said, even if we all want to take the leap and go straight into innovating, we have to know where we came from to know where we are going. Yet another cliché, I know. But bask in it, because when anyone takes a leap, it is always off of some solid foundation.

It is thanks to the use of design patterns that students such as I, brand new to software development, can build working sites and full-stack applications. In my second semester of programming, I used Singletons for an abstract pizza bakery. A month ago in class, I added functionality to a site that uses Prototypes, MVC, and other design patterns. For the final project of my software engineering course, I am working with a team to develop an application for athletic trainers to share information seamlessly with athletes. We rely heavily on the Publish Subscribe model to push information onto a database through one function and use this data to propagate information in other functions. This application is also built on Meteor and thus implements a Reactive Data version of the Observer design pattern. My team is able to build a functioning site, thanks to design patterns used in the industry and design patterns implemented by our professor for the shell of our application. It is all thanks to the inheritance of knowledge passed down by many generations before us that we are able to keep progressing.