What’s the Deal With Patterns

August 28, 2017

As an instructor, I am asked from time to time to explain what patterns are.  It seems to be one of those things that new developers often hear dissertations on from the hallowed halls of software architecture then walk away more confused than when they started.  There are vehement opinions on which patterns are the cream rising to the top and which are nothing more than an incessant scourge on our profession.

For someone just learning the craft of software development, the basic syntax and structure of their chosen language can be enough to understand without trying to digest the purpose of a set of patterns.  I usually start to explain patterns by telling my apprentices what they are not.

Patterns are NOT:

  • A magic bullet by which all software development is miraculously completed in record time.
  • A way to ensure that your code will be free of defects.
  • A one size fits all approach to development.

In my time as a professional developer, I often have seen newcomers discover a pattern and glom to it. They become evangelists and bow at the altar of the pattern.  It often becomes an expectation on their part that every problem they are presented with can and must somehow be shoehorned into this new way of doing things.  This is a danger that must be avoided.

What Patterns Are

Patterns are simply a way to write and organize your code as repeatable/reusable segments that solve specific problems.  Did you catch that?  The problems that patterns solve are specific.  This means that any given pattern is not one size fits all approach.  When you run across a specific problem and you solve that problem in a way that allows you to reuse your code to effectively and efficiently solve that same problem again next time, then you have created a pattern.

That’s another point about patterns.  We can write our own patterns.  Becoming effective as software developers means we need to have a box full of tools to use to solve problems more quickly.  Patterns are among the tools that should be in there.  When we discover a pattern in our development, we should hold onto it for future use. That said, there are also a large number of existing patterns that have become prominent within the industry.  It will benefit you to learn about them and the problems they solve.  I am going to start a series of posts exploring some of the more popular patterns, explain their purpose, and provide some examples of their usage.

Learning about patterns is a valuable undertaking, but if you are new to the field you should first master the basics.


Comments are closed.

DevCoaches © 2016 - 2017