GUI and non-GUI data

Discussion in 'Ruby' started by Hal Fulton, Aug 5, 2004.

  1. Hal Fulton

    Hal Fulton Guest

    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?


    Hal
    Hal Fulton, Aug 5, 2004
    #1
    1. Advertising

  2. 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 *
    * Alternate:
    Austin Ziegler, Aug 5, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Laszlo Szijarto
    Replies:
    0
    Views:
    402
    Laszlo Szijarto
    Jul 2, 2003
  2. Krick
    Replies:
    2
    Views:
    3,165
    Olaf Heimburger
    Jan 10, 2004
  3. Rhino
    Replies:
    14
    Views:
    7,470
    Chris Uppal
    Dec 14, 2005
  4. Les Caudle
    Replies:
    1
    Views:
    339
    Cowboy \(Gregory A. Beamer\)
    Sep 19, 2006
  5. Artur Ergashev
    Replies:
    0
    Views:
    284
    Artur Ergashev
    Aug 15, 2011
Loading...

Share This Page