From: Austin Ziegler Date: 2004-08-06T05:42:28+09:00 Subject: Re: GUI and non-GUI data On Fri, 6 Aug 2004 05:13:07 +0900, Hal Fulton wrote: > I'm refactoring some ugly code and looking for some general > high-level advice. > > I'm always rather at a loss when it comes to separating the GUI-related > data from the non-GUI data. > > For example, a Note might have certain attributes. But a NoteWidget, which > would know about a Note, would have different (GUIish) attributes. > > But I'm a little uncomfortable with this separation, and I always end up > with a certain tangling anyway. > > How do you handle this sort of issue? It varies. I think we're using a variety of things in Ruwiki (not gui, per se, but still). The backends are handled through delegates. The tokens are handled through inheritance. Both are right for the choices made. I think I did a decent job of allowing for alternative FEs to RTidy/CD, although I don't think much of the rest of the code in the app at this point (my first "big" Ruby program). If a single NoteWidget can represent one of any number of Notes, then delegation is probably the right choice. If the GUI will create a NoteWidget for each Note, then inheritance is the right choice ... IMO. Someone else will probably have a different opinion. -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca