From: Alan Chen Date: 2001-11-02T07:23:30+09:00 Subject: [ruby-talk:24120] Re: Modularity question On Fri, Nov 02, 2001 at 05:04:04AM +0900, Hal E. Fulton wrote: ... > For one thing, I want to allow at least two different > UIs (graphical (Tk?) and text-based), and I want the > possibility of changing the graphical part later > without too much difficulty -- maybe even adding > a web interface or some other. ... > My first thought is to have a very high-level interface that > simply handles things in a way utterly transparent to the > main logic -- using calls that mean "ask the user for a > yes or no response" or "get the object that corresponds > to this name or key." > > I could then (for the UI) do a different "require" based on > a command line parameter or whatever. > > But I can't help feeling that I'm overlooking a chance to > Do Something the Right Way. > > Anyone have opinions on this? > > Hal Unfortunately, my short term opinion is that it would be a pretty huge undertaking, and that I wouldn't hold up any of my other projects for such a library. It would probably be easiest for your immediate project to just choose one interface lib (curses or Tk), write a clean interface to your user interactions and come back later to add interfaces on a per "screen" or "dialog" basis. In the long term I would love to have an interaction based library which could use several different backends - GTK, the Web, curses, etc. In my (miniscule) spare time, I've been trying to think about how to get from here to there. I think that prototyping several small, specific instances of interaction semantics is a good start. (Ruby is an ideal language for this) Alternately, one could start by taking a glade specification file and trying to render it using HTML, Tk, or curses interfaces. I think you could get something workable sooner this way, but the paradigm would break down faster. (i.e. you'd get to some limit in how to grow the library and then have to rewrite sooner) Plus, glade specs are inherently gui form based, and not really interaction based. -- Alan Chen President and Lead Developer Digikata LLC alan@digikata.com http://digikata.com