samedi 2 juin 2018

Flyweight pattern dilema

This tutorial http://dofactory.com/net/flyweight-design-pattern shows a good explanation of the Flyweight pattern. Anyway let's say that we want to change the font size of the this.height = 200; (assume that the properties are not protected). That means that all the font sizes will be changed since objects are of reference type. Let's say that this is a text editor, and we want to change the font size only of a specific letter (single instance of the letter, not all). So now a problem occurs, since if we somehow change font size of the object in the dictionary, all of the occurences will be changed. How to deal with this?

Aucun commentaire:

Enregistrer un commentaire