What is a Design Pattern? (Answered.)

I recently answered that question:

images.duckduckgoThe entire concept of Design Patterns for software was popularized and maybe invented by the Gang of Four. This is the book. It’s an amazing artifact, organized differently from any other book I’ve seen. It’s worth checking it out from a library and reading at least the introduction and a few designs.

That wiki, by the way, by Ward Cunningham (the inventor of the wiki) is a similarly amazing resource. You can lose days reading the articles there.

A lot of people say that “design patterns are simply features that are not natively present in the programming language.” And for sure, design patterns grew out of the Smalltalk and C++ communities — the early object-oriented languages.

But to get right to it: a design pattern is nomenclature. It provides names for engineers to use and communicate better. They also provide a set of well known recipes which have evolved over time; they should help people avoid re-inventing the wheel.

strategy
The Strategy pattern

Design patterns are recipes for how you use groups of classes, objects and methods. They’re sort of larger chunks of coding habits. For example, OO language supports inheritance. But when should it be used? And what are top-3 most common “patterns” in which we see it show up? Design Patterns, the book, catalogs these. They have names like Template Method, and Strategy.

My knowledge of patterns helps me come up with solutions to complex programming challenges. For example, I want my site to do different things depending on whether the topic is California vs. New York. How should I organize my code containing these specializations? Design patterns give clues.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s