Skip to content
Petar Minev edited this page Jan 4, 2016 · 2 revisions

Flyweight Dp is used when we have one of the following situations:

  • Memory constrain;
  • Generation of many identical objects with little difference;

The Flyweight dp is described with two states:

  1. Intrinsic State - this is the state which is shared with multiple object;
  2. Extrinsic State - this state can varies in different object contexts and cannot be shared

so to be much more clear the differences between those two states let me give you an example: let's have game in which the hero should collect coins which have different values,so in the table below I've splited the object inthe needed states:

Interinsic Extrinsic
coin form coin value
coin fall speed coin back pic

External links: Code Project Source Making

Clone this wiki locally