Stop Redesigning the Wheel

01 May 2018

Practice makes perfect for tackling a new concept, but this repetition can become increasingly inefficient over time as one’s experience grows. At some point, solving a problem that you are extremely familiar with becomes muscle memory. Despite being trivial, solving the presented problem still takes time. What if there was a way to streamline this process by reusing a previous known solution instead of starting from scratch every time? Well, there is: enter design patterns.

These design patterns are essentially a base template that can be lightly modified to solve numerous variations of a problem. They can be classified in three major categories which include creational patterns which deal with object creation, structural patterns which deal with object composition, and behavioral patterns which involve communication between objects. Because solutions based on design patterns are derived from the same overarching base template, it is easier for other software developers to understand the thought processes behind design pattern based solutions. More often than not, these same developers have used the same or similar design pattern before so they are able to relate the presented solution with their own to an extent.

Through my growing experience with software development, I am finding that design patterns are becoming more apparent in my code. Some of these design patterns include the Observer and Template Method patterns. These were demonstrated in my group’s final project. The Observer design pattern was shown in our conditional renders and collection filtering based on the state of various filters and user types. The Template Method was applied to omnipresent components on our site such as the navigation bar and footer so that the modules could be reused on different pages.