Going through school, one reoccurring thought I had multiple times a day were “I know someone else has already found a solution to this problem and its online, so why do I have to solve it?”. Now, I understand why I needed to solve it-so I fully understood the concepts and have a strong foundation in my education for future courses. However, it still irked me when I had to do the same mundane process before I could actually solve the problem I was working on. But as I further my education in computer science, I realize the real world doesn’t always work the same way. Sometimes the mundane processes are readily available for use, and all you need to do is build off of them or tweak them to solve the issue at hand. And this is the beauty of design patterns.
Design patterns are like recipes. To use an exact example, I’ll use cookies. People bake cookies all the time, whether it be for a holiday, for a special event, or just because. Furthermore, 90% of cookies have the same base- flour, sugar, eggs, butter, vanilla, etc. Most people when they want to make cookies follow a recipe. But maybe they found a recipe, but want to modify it to meet their needs – add some nuts to their chocolate chip cookies, or lessen the amount of butter used. The foundation is still the same, and was extremely beneficial (they didn’t have to guess what ingredients were needed and in which ratios), but the small details were modified a bit. This is similar to design patterns. Many issues within computer science have already been addressed and solutions have been found, and the community as a whole has acknowledged there is no sense in continuing to spend precious time creating a basis when it had already been done. If I want to make cookies, I don’t want to spend hours trying to hammer down the perfect recipe, I want to already have the recipe and make tweaks when needed.
In software engineering, we have reached the points as students where we are expected to understand basic code, or understand where to find solutions to understand basic code. We have moved past the individual building block stage and into the actual building stage- putting everything together to form one coherent final project. With this task comes the privilege of having access to previously constructed foundations. For example, the final project for our software engineering course is to create and interactive web application. Each group was given the ability to choose their web applications, just like people can choose what kind of cookie they want to make (chocolate chip, oatmeal raisin, snickerdoodle, etc). However, like the cookies, each group will be using the same foundation for their application. There’s no sense in making each group spend hours reconstructing the same base, when they can use a previously built base and modify it to perform the needs of their application.