Design Patterns

A Design Pattern is a solution to a recurring design problem.

Pattern Essentials

  1. Pattern Name - Provides a method to communicate about design and formalizes an idea thus allowing user to say "I've seen this before."
  2. Problem - When do you apply this pattern.
  3. Solution - An abstract description of problem design that can be used on many problems.
  4. Consequences - Costs and benefits of applying a pattern.

Catalog Organization

There are 23 patterns in the Catalog. These are grouped using two criteria. The first is purpose. All of the patterns are divided into three main purposes.

A second way to classify patterns is their scope. This classification is based on whether a pattern applies to classes or objects.

How Design Patterns Solve Design Problems

Finding Appropriate Objects

Hard part of ood is decomposition of a system into objects. The following factors influence decompostion, often in conflicting ways.

Some of the classes are based on concrete (real-world) objects while others are problem solving artifacts such as structures (arrays etc.) and abstract base classes.

Some Important Patterns


Inheritance vs. Composition (Aggregation)

Inheritance (is-a) versus Composition (has-a) is an important decision in class design. Some important points of the section:

Weaknesses of Inheritence
Advantages of Composition