"Hal Fulton" <hal9000 / hypermetrics.com> schrieb im Newsbeitrag news:426821C2.3040705 / hypermetrics.com... > Sometimes I stare at the monitor and think: Is it too late > to change majors? > > I'm about to start a rewrite of Tycho in my <sarcasm>copious</sarcasm> > spare time. > > For those curious about this tool, see > http://tycho.rubyforge.org > or the RubyConf slides at > http://rubyhacker.com/tycho/slides > > The basic paradigm is a hierarchy of categories, each consisting > of a pile of notes. But structuring the code in proper OO fashion > is nontrivial in my view. > > I have spent much time scribbling on napkins and muttering MVC > jargon to myself, but to little avail. I'm confused and my > brain is itching. > > As one of the slides indicates, part of my confusion is different > ways of thinking about what a "note" is. > > Sometimes I perceive it as: > - an object of a certain class > - the actual text of the note > - the text plus its metadata > - the YAML'd version of the text+metadata > - the key used to look up the record in the db > - the text field in which the text is displayed > - the parent widget to which that text field belongs > - or something else. > > I like the idea of composing an object of smaller objects -- > for example, store all the GUI stuff in note.widget or > note.gui or something. > > But then (among other complications) the note has a title > (note.title) which is also stored in the GUI (note.widget.title) -- > these must be kept in sync. :/ And so on. > > What are your mental (or other) tools for dealing with this sort > of complexity? I'm sorry, I don't have the time to look deeper into this ATM. But one thing about your post strikes me as odd: you mention "note.widget". This sounds to me as if the model (note) contains view components (widget). I think usually it's the other way round: the widget knows the model but the model doesn't know anything about representation. So it would rather be "note_widget.note" and this would also remove your problem with the title synch: "note_widget.title" would look like this "class NoteWidgeg; def title() note.title end end" (you probably could use delegation for this). Just my 0.02 EUR.... Kind regards robert