Design Patterns

09 Dec 2018

Design is Everywhere

Look around you and notice something that has a functional design...

As long as humanity uses tools to do things, engineers will face functionality problems. We solve these issues by using existing tools in a new and different way, or making our own to do such a task. However, the issue of optimal design is not mutually exclusive.

Design patterns are repeatable solutions to common software engineering problems. They are general templates that require optimization for your specific implementation. Using a design pattern to it’s fullest takes experience, but if you’ve got the right one for the job, it will work for you.

My Design Pattern Preferences

My early experience in languages like Java and C++ had me relying quite heavily on factory patterns. Utilizing black boxes baked into their libraries was the quickest way to achieve my goals. However, due to high overhead in lines of code I was never really exposed to singleton patterns.

Recently though, my general go-to is JavaScript, where composite, one-off patterns are extremely useful. When implementing user-generated event handling I can lean on the decorator, and flyweight patterns for shorter, less error prone code.

The most thorough, in my opinion, is the Model-View-Controller (MVC) design pattern. A close runner up is the publish-subscribe system. With this pattern, JavaScript almost comes to life.

My Experience With Design Patterns

Creational Design

In Java and C++ I often find myself gravitating here

Structural Design

These can help with reusability

Behavioral Design

My creative side comes out when I use these