Original Post
Hi everyone! We've been working on a side project where we've been creating our tools using C# and a C# OpenGL wrapper. The problem being encountered is one of correct design, and making the tools extensible so we don't have to hack around everything when we want to extend on it. With that being said, I wanted to detail the main problem we are encountering: I'm not sure if it was because of classes at school, or general design decisions, but we have been embedded the actual data into the controls themselves. So, for example, if a numeric up down changes, we then handle that event, and inside that control's event handle function, we not only send events to other controls that the value changed, but we change the data embedded in that control. As a result, if the data embedded in this control is part of a larger object containing it, then another control will contain the larger objects. This means that not only would update the information stored in the smaller control, but you'd have to update the information store in the larger control as well. This seemed like not only an exponential waste of memory, but processing time as well. My question here is, what is a good design strategy to solving the problem? One idea i had was creating a singleton that stored all possible data used in the entire system, and then have the controls directly alter or get data from the singleton, thus meaning if a smaller control changes the data, it will be reflected in larger controls without having to store it everywhere. Is this a valid strategy, and if not, is there a better someone can suggest? Also, embedded data everywhere seems to be a very bad idea as well because it seems that passing List<"class name">'s around is favored very highly in designer due to serialization issues... Thanks in advance everyone!