vendredi 27 mars 2015

Should I ever reset object state?


I have a series of TextBlocks which are drawn on frames to make a video of a book. I do it when user click on Make Video. User may change the content of some blocks and click again on Make Video. I should reset some state of the TextBlocks (e.g reset LastWrittenWord to null). As I discussed it earlier it is a sign that I have mixed two responsibility for TextBlock (Drawing, Preserving content).


I would like to know can I conclude, every time which I need to reset some state of an object, I have had a bad design? I think on each click on Make Video I should instantiate some TextBlockDrawer to draw the TextBlocks again instead of resetting the object state!.





Aucun commentaire:

Enregistrer un commentaire