Software Design Patterns

What is a design pattern?

I have read that it is an instruction, a three part rule, a relationship and a thing while at the same time a process.  To understand it, I appreciate the multiple views.  Knowing that an elephant is a large herbivorous mammal is more informative when you also know that it is a thick skinned animal which a trunk and tusks as well.  The 3 definitions that comprise my understanding of this reusable problem solving element are:

  • A pattern is a named nugget of insight that conveys the essence of a proven solution to a recurring problem within a certain context amidst competing concerns.
  • Each pattern is a three-part rule, which expresses a relation between a certain context, a problem, and a solution.
  • As an element of language, a pattern is an instruction, which shows how this spatial configuration can be used, over and over again, to resolve the given system of forces, wherever the context makes it relevant.

These design patterns join forces to create the design language.  Ideally they are gathered together in a reference book, like words in a dictionary, to act as a reference.  Have this problem?  Here is the solution name, a description, some cross references and, of course an explanation of why this is a fabulous solution to the problem. 

Where did all this come from anyway?

Notice that all of this language is pretty generic?  It seems that it can be applied to just about anything.  Well, it is.  Christopher Alexander originally wrote his 1977 book A Pattern Language to address the design issues in his field of archictecture…the architecture of buildings that is.  Yet, Alexander saw this as applicable across fields.  It was particularily compatible with the feild of software design.  In 1994, the Gang of Four (Gamma, Helm, Johnson & Vlissides) addressed this in Design Patterns in which they provide sollutions to commonly occuring software problems. 

An example of a behavioral pattern addressed by the Gang of Four is the Observer pattern.  An observer pattern is a one to many relationship in which a change in one of object effects each of the other objects in the relationship.  For instance, in the practice final for our programming class which takes in bids for an online auction, the winning bid effects the status of all of the other bids to make them losing bids.  Each new bid is observed and then affects the status of the other bids.  The notification of the winning bid is then announced along with the status of all of the losing bids.

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s