Are Utilizing Design Patterns Necessary?

02 Dec 2020

The Basics

If you think about almost any task or problem, in order to obtain a solution, a certain procedure is usually used. Whether this is a step-by-step procedure similar to the scientific method - which starts with a question, then a hypothesis is formed, which eventually continues to move into an experiment, and ends with a conclusion - or something more specific such as algorithms for sorting: chronological, alphabetical, etc. Either way, a format is used, and this is because it has proven to be successful in producing an accurate outcome in comparison to its counterparts. Implementing this ideology into coding, design patterns are an effective way to obtain an organized program. A good comparison that describes design patterns is they are to coding as blueprints are to buildings. They provide a structure for the user to follow that are usually the best practices used by other developers. There are many different design patterns used in coding, each having their own function.

Implementation

Over the period of my computer science course, if I have ever used any specifically defined design patterns with coding, I was unaware I was following one. Although, I can confidently say that I have used the general idea of design patterns in much of my previous work. I have unknowingly been using them and have only recently learned about what they are in the past week through a few screencasts provided by my professor. An example of a design pattern I have implemented would be prototyping. Every time I use classes I use the prototype design pattern, which is when I want to copy a new object from a separate instance (or a prototype). I have also used collections in my coding, they fall under the singleton design pattern have a similar idea to prototypes, they allow the user to create a class with only one instance. Another interesting but essential feature used in my programming is the publish and subscribe method. This falls under the observer design pattern and its purpose is to help the user observe any mutated files. Overall, I believe that the core of design patterns is remarkably similar to how we procced in dealing with problems in real life and should be utilized when developing, to help smooth over potential issues.