Design Patterns:Evolution of Problem Solving

03 Dec 2020

What are Design Patterns

Have you ever notice the same designs shows up in buildings and infrastructures all the time? For example, how all cable bridges looks the same, with cables connecting from different points of the roadway on to a tower forming multiple triangles. The answer is simple, because it works well. Why reinvent the wheel, when the design already works well. That is the basic idea of design patterns, we use a solution that we know is effective against a problem, and apply it to that type of problem over and over again. It is efficient and easy to understand. Design patterns contains many patterns for different problems, it is like evolution, survival of the fittest, the less efficient patterns are less used against a certain type of problem and are weeded out by the users who chooses a more efficient pattern.

Identifying Design Patterns

This is the most difficult part of design patterns to me, not because it is hard to find them, but it is hard to notice them and tell them apart. Even though we are constantly applying design patterns in our works, we rarely talk about them. We’ve been using the Model-View-Controller design pattern in all our Meteor application so far, yet I’ve only learn about it not so long ago. We are often taught the best and most effective design pattern that is available, to the extent that we stopped questioning why we are doing it a certain way.

Learning to use Design Patterns

Perhaps it is way too easy to use design patterns, to the point where we are constantly applying design patterns to solve problems without noticing it. All our life we been taught to use design patterns to answer problems in school. When we solve linear equations, we use to y=mx+b format to identify and solve it, over and over again. When we need to solve a problem that is made up of multiple similar sub-problems, we use recursion. When we want to manipulate a MongoDB collection, we use the singleton pattern to create and export a single instance of a collection class. At first we might be hesitant use these patterns but the more we use them and the more problem we solve with them, we become much more natural at apply them.