Design Patterns

1551 Words4 Pages

Design Patterns

What is a Design Pattern?

A design pattern solves a problem within a given context. The solution that is offered by implementing a pattern results in a system design structure, which balances the concerns of the design problem in a manner most appropriate for the given context. In “Understanding and Using Patterns in Software Development”, Dirk Riehle and Heinz Zullighaven offer a rather nice definition of what a design pattern is:

“A pattern is the abstraction from a concrete form which keeps recurring in specific non-arbitrary contexts.”

The ability to write good patterns is very difficult. A pattern should not only convey the facts about a system, but it should also tell a story about the system. It should allow the systems users to comprehend it, be able to customize it to accommodate new features.

Elements of a Design Pattern

A design pattern can be made up of the following components:

Name

The design pattern must have a meaningful name to allow a developer to use a single word or short phrase to reference the pattern.

Problem

The problem describes the patterns intent, the goal and objectives the pattern wants to achieve within the given context.

Context

The context of the pattern is the preconditions under which the problem and its solution seem to recur, and for which the solution is desirable.

Motivation

A description of the relevant forces/constraints and how they can interact/conflict with each other and the goals the pattern wishes to achieve.

Solution

The solution illustrates the structure of the pattern through UML diagrams, textual descriptions that include the patterns collaborations and participants.

Sample Example

One or more sample applications of the pattern which i...

... middle of paper ...

... the learning process.

Learning Design Patterns

Michael Duell of AG Communication Systems presented a novel approach that may be adapted to introduce design patterns. He compares the theory behind design patterns to a real world model, illustrating the workings of the pattern implementation by giving trivial examples that a developer may be better able to relate to than the formal explanations offered by GoF or Holub for example.

When describing the Abstract Factory pattern, he uses the example of sheet metal stamping in an automobile company. The stamping equipment is an abstract factory, this creates the various car body parts. The same machinery is used to create right and left hand doors, right and left front fenders etc. By changing the stamping dies, the concrete classes produced by the machinery can be changed with minimal disruption to the whole process.

Open Document