RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Java
Expertise: Beginner
Jun 29, 2000

What Are Design Patterns?

A design pattern is a design solution to a software problem that occurs within a specific, recurring set of situations.

Let's say you are making software for a problem situation that involves a heat sensor, and an overheat alarm. And let's say that whenever the sensor senses temperature above a certain threshold, you'd like the alarm to go off. One way of dealing with this is to have the alarm trigger part constantly poll the sensor. this works, but is a bit wasteful. A more intuitive way is to treat the alarm trigger on a need-to-know basis, that is, have a mechanism that would enable the sensor to send a message to the alarm trigger whenever the heat threshold would exceed.

Now, expand this situation so that it can apply to problem domains other that heat sensor: You've got mail notification, account balance negative notification, delivery failed notification, etc.

Here, we are dealing with a problem that shows a pattern of occurrence in a similar problem context with different problem specificities. A solution for the this kind of recurring problems that concerns the context, and not the specificities of the problem is a design pattern.

For example, for the problem above, pattern practitioners have devised the "Observer Pattern", whereby a party interested in a certain event expresses its interest to another party watches for that event, the latter notifies the former if such event happens.

You can also think of design patterns as recipes for design, or reusable design works that are devised to solve a specific, recurring problem.

There are many design patterns published in a variety of books, or journals, or on a variety of web sites.

A good place to start is "Design Patterns: Elements of Reusable Object-Oriented Software (Addison-Wesley, 1995)" by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. These guys were pioneers in design patterns, and most, if not all, of the patterns presented by them are widely used by software designers.

Another good book is "Patterns in Java (John Wiley & Sons, 1998)" by Mark Grand. This one runs over three volumes, and uses Java to code its patterns.

You can also check:

http://hillside.net/patterns/patterns.html http://www.objenv.com/cetus/oo_patterns.html http://rampages.onramp.net/~huston/dp/patterns.html

The true power of Java lies in its Object Oriented facilities. Familiarity with design patterns will enable you to identify recurring design situations, and let you reuse other object practitioner's design works.
Behrouz Fallahi
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date