Patterns by Design

23 Apr 2019

Spotting a Pattern

Design patterns play a major role in everyone’s lives and is definitely not something that is exclusive to coding. It is essentially the frameworks or building blocks for a solution to a common problem. Design patterns apply to practically everything, from building a proper house to how to microwave food, and help to ensure any kind of problem is solved more effectively and more efficiently. While they are everywhere, at times design patterns can be difficult to find, especially when coming across a problem for the first time. Often, research is the best way to spot design patterns, whether it is from following the ideas of others or testing your own solutions. By finding a more general solution to the problem, a design pattern is acquired.

Weaving Patterns into Code

Design patterns in coding is essentially the main reason why programmers can even get things done in the first place and is a core part of programming. At its core, every single line of code in any program is part of some pattern, as code is really only made to solve some kind of problem. As for specifics, specific design patterns are most often referenced in the event that a problem occurs, and someone else has already solved some iteration of that problem. For example, during the Javascript portion of ICS 314, I was having issues regarding how to sort through arrays and objects. By doing research, I was able to come across similar problems that had already been solved. By taking the base of the solution (the pattern) and applying it to my issue, I was able to solve the problem. By finding this method, I was also able to easily solve other similar issues that popped up in the future.

The Importance of Proper Design

While design patterns can be generalized very often and can often be found relatively quickly, it is important to that each design pattern always has some kind of drawback. By running tests, it can always be shown that some solutions to a problem are much better in one aspect, but also much worse in another. it should be noted that there really is no such thing as a perfect pattern, but every design pattern is useful in one way or another.