1 minute
Contact me

Name: Proxy

Type: Structural

Use when you want to:

Represent the functionality of anoter class.

From Wikipedia:

A proxy, in its most general form, is a class functioning as an interface to something else. A proxy is a wrapper or agent object that is being called by the client to access t...

1 minute
Contact me

Name: Flyweight

Type: Structural

Use when you want to:

Avoid recomputing data that has previously been computed. (memoization).

From Wikipedia:

In computer programming, flyweight is a software design pattern. A flyweight is an object that minimizes memory use by sharing as much data as p...

1 minute
Contact me

Name: Facade

Type: Structural

Use when you want to:

Provide a simplified interface to a complex subsystem.

From Wikipedia:

A facade is an object that provides a simplified interface to a larger body of code, such as a class library.

Real World Example:

What do you do turn a compu...

1 minute
Contact me

Name: Decorator

Type: Structural

Use when you want to:

Change the behaviour of one object dynamically and transparently, without changing the class of objects.

From Wikipedia:

In object-oriented programming, the decorator pattern is a design pattern that allows behavior to be added to an...

1 minute
Contact me

Name: Composite

Type: Structural

Use when you want to:

Selectively treat a group of objects that are part of a hierarchy as "the same" when they are in fact different.

From Wikipedia:

In software engineering, the composite pattern is a partitioning design pattern. The composite pattern...

1 minute
Contact me

Name: Bridge

Type: Structural

Use when you want to:

Handle orthogonal ("Changing A does not change B") concerns separately. Think colors, shapes.

Variants

From Wikipedia:

The bridge pattern is a design pattern used in software engineering that is meant to "decouple an abstraction fro...

1 minute
Contact me

Name: Adapter

Type: Structural

Use when you want to:

Make interfaces compatable

Variants

From Wikipedia:

In software engineering, the adapter pattern is a software design pattern that allows the interface of an existing class to be used as another interface. It is often used to make...

0 minutes
Contact me

Name: Prototype

Type: Creational

Use when you want to:

Clone an object rather than create one

From Wikipedia:

The prototype pattern is a creational design pattern in software development. It is used when the type of objects to create is determined by a prototypical instance, which is clo...

1 minute
Contact me

Name: Singleton

Type: Creational

Use when you want to:

  • To manage a shared resource.
  • To read global state.

A quick note:

There aren't a ton of reasons to ever use a singleton. If however you want global information to flow into the singleton and not back into the app again, then it is a...

1 minute
Contact me

Name: Builder

Type: Creational

Use when you want to:

  • do lots of things to build an object
  • design classes whose constructors or static factories would have more than a handful of parameters.

From Wikipedia:

The builder pattern is an object creation software design pattern with the inten...