Design patterns – Your problem was solved before you ever had it

Sir Isaac Newton

“If I have seen further it is by standing on the shoulders of giants.”

So you are stuck on a problem? You’ve been trying to figure out a solution for hours but came up short. Welcome to the wonderful world of software development!

The great thing about software development is that most problems have already been solved by someone else. You might argue that your system is unique and your problem is too, but I’m betting that you could probably find a solution to your problem if you tried applying a design pattern to it.

Joy Gas service station elevation drawings, 910 Lake Shore Road Blvd W., Toronto, Canada.A design pattern is a reusable solution to a commonly recurring problem. It won’t give you a step by step guide on how to solve your exact problem but it will give you a template of best practices that you can follow, a blueprint of sorts, on how to solve your specific problem.


There are four main categories of pattern types to be found: Creational, Structural, Behavioral and Architectural. Every one includes a subset of different patterns that handles problems of a certain type.

Creational Design Patterns

These patterns deal with how objects are created and try to give you ideas of how to handle this in a way that best fit the situation, in order to avoid design problems or added complexity.

The goals of the patterns are to separate the system from how the objects are created, composed, and represented in order to increase the system’s flexibility.


A simple diagram on factory methods

Factory method pattern

Two well-known creational design patterns are the Factory Method pattern that gives the responsibility to create an object to a factory that chooses from several different implementations and the Singleton pattern that restricts the implementation of class to one object.

Structural Design Patterns

Structural patterns define how the modules and components should be organized so that interacting modules can work both flexibly and extensibly together in large systems.

The goal is to simplify the design by identifying a way to realize relationships between entities not only by specifying the methods that connects the objects but also how data moves through the pattern.

The most famous structural design pattern is probably the proxy pattern that gives an object functioning as an interface to another thing.


Architectural Design Patterns

Architectural patterns help with issues on a system design level. Computer hardware performance limitations, high availability and minimization of business risks are all problems that are aided by these design patterns.

Image showing how the MVC pattern works

Model-View-Controller pattern

A well-known example of an architectural design pattern is the Model-View-Controller (MVC) pattern, used for interfaces, that separates an application into three parts in order to organize what information objects should present or accept from the user.

Behavioral Design Patterns

Behavioral patterns inform objects and classes about how to communicate and behave in regards to one and other. By identifying and realizing different patterns for objects to interact we can increase the flexibility of the communication for these objects.

The goals of the patterns are to be able to change or switch different objects and behaviors without having any code affecting the interface for the users of these classes. Most of the patterns are concerned with object-oriented systems.

An example is the observer pattern which is a key part in the MVC pattern mentioned earlier holds references to different dependencies and notifies them on any state changes.



Design patterns have been around and been tested for years, wHead First Design Patternseak points are well known and avoidable. I would recommend that you get a copy of Head First Design Patterns as this explains when it’s appropriate to use a certain pattern. Knowing about design patterns and learning how to use them are a fast way for inexperienced developers to quickly become better. That said, it will always be better to write simple code than to implement a pattern just because it exists.

If you like it, spread it.facebooktwittergoogle_plusredditlinkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>