Skip to main content

Design pattern

A design pattern is a REUSABLE model for common problems.

We must see this as a global strategy that we can put in place to resolve this in an accelerated manner.

Here are creative design models around OOP

5 Types

Factory Method

  • Create an abstract interface / class
  • modifies dobj creation in subclasses.

When ? When the dev does not know in advance the exact types and dependencies of the project objects

Singleton

  • creates a single instance of an object
  • provided a global access point to this instance

WHEN ? A program class has only one instance available to all clients.

Prototype

  • copy an existing object to create a new one.

When ? to reduce the number of subclasses that differ only in the way they initialize their objects

###Builder

  • design complex objects using simple objects via a step-by-step approach.

WHEN ? to create different modified variants of an object

Abstract factory

  • produces sets of related objects
  • factory set
  • (not included ajd)