notes

it seems like "design patterns" are not exclusively restricted to 'object-oriented-programming', but this is the context in which I have learned such design.

there are three main categories of Design Patterns as decreed by the 'Gang of Four'1 (the authors of a seminal work Design Patterns | Elements of Reusable Object-Oriented Sofware.

  1. Creational Patterns
  2. Structural Patterns
  3. Behavioural Patterns

in turn, each of these contain more patterns:

  1. Creational:

    1. Factory Method
    2. Abstract Factory
    3. Builder
    4. Prototype
    5. Singleton
  2. Structural

    1. Adapter
    2. Bridge
    3. Composite
    4. Decorator
    5. Façade
    6. Flyweight
    7. Proxy
  3. Behavioural:

    1. Interpreter
    2. Template Method
    3. Chain of Responsibility
    4. Command
    5. Iterator
    6. Mediator
    7. Memento
    8. Observer
    9. State
    10. Strategy
    11. Visitor

because these patterns tend to be solutions to bad design smells, I've decided to include all the details on a single page.

design smells

duplicated code

long method
large class
long parameter list
divergent change
shotgun surgery
feature envy
data clumps
primitive obsession
switch statements
parallel inheritance hierarchies
lazy class
speculative generality
temporary field
message chains
middle man
inappropriate intimacy
alternative classes with different interfaces
incomplete library class
data class
refused bequest
comments

comments are good, but sometimes they are used as deoderant for bad code!

Footnotes


1

Ralph Johnson, Richard Helm, Erich Gamma, and John Vlissides.