I am confused between the difference of these states for the Flyweight
pattern.
I am aware that intrinsic
state is the state that is shared and that Extrinsic
is not.
However I do not see the importance that extrinsic
state has within the pattern or within the example below:
public static void main(String[] args) {
// Create the flyweight factory...
EngineFlyweightFactory factory = new EngineFlyweightFactory();
// Create the diagnostic tool
DiagnosticTool tool = new EngineDiagnosticTool();
// Get the flyweights and run diagnostics on them
Engine standard1 = factory.getStandardEngine(1300); //intrinsic
standard1.diagnose(tool); //extrinsic
Engine standard2 = factory.getStandardEngine(1300); //intrinsic
standard2.diagnose(tool); //extrinsic
Engine standard3 = factory.getStandardEngine(1300); //intrinsic
standard3.diagnose(tool); //extrinsic
Engine standard4 = factory.getStandardEngine(1600); //intrinsic
standard4.diagnose(tool); //extrinsic
Engine standard5 = factory.getStandardEngine(1600); //intrinsic
standard5.diagnose(tool); //extrinsic
In reference to the example given in Wikipedia about a text editior. Is the intrinsic state the letter, and its extrinsic state the font, colour etc?