comp.lang.ada
 help / color / mirror / Atom feed
From: "Warren W. Gay VE3WWG" <ve3wwg@cogeco.ca>
Subject: Re: [OT] Best way to isolate a GUI? (The final concensous?)
Date: Fri, 21 Feb 2003 13:02:48 -0500
Date: 2003-02-21T13:02:48-05:00	[thread overview]
Message-ID: <3E5669C8.30305@cogeco.ca> (raw)
In-Reply-To: b341q8$kuu$1@slb0.atl.mindspring.net

Marin David Condic wrote:
> Well, if you use an existing GUI such as Windows or Motif, you are *going*
> to have callbacks. I'd prefer to isolate them in some kind of wrapper layer
> and have the "real" app receive messages of some sort. If you were building
> a GUI from bottom dead center, you could build that sort of thing right in.
> I'm just saying I think that callbacks are an ugly kludge that I'd prefer
> were done a different way. You might be able to get there with existing GUIs
> & glue or wrappers or skins or whatever you like to call it. Just expressing
> a desire to see an interface to a GUI that doesn't have to know anything
> about the code *I* write. :-)
> 
> MDC

If we were to belabour this discussion a bit further, it seems to me
there are two points worth discussing here:

   1) What is it about callbacks specifically that you don't like?
      I think this needs to be defined beyond "ugly kludge".

   2) What other suitable models are there (with pros/cons)?

The problem that we're dealing with here is an event driven system.
Callbacks are similar to interrupt programming as you've stated.
Outside of the callback (in most GUI apps), you have a main loop
that basically receives events and dispatches them (invoking ultimately
in some cases, callbacks).

The things I dislike about callbacks include:

   1) restricted access to application data (normally just "user data").
   2) each event code is a separate procedure (some may see this as a
      feature).
   3) code restrictions: ie. you must not tarry too long there, or you'll
      hang the main loop (making it not respond to more GUI events).
   4) more code restrictions: sometimes there are some GUI related
      operations that are restricted within a callback (much like malloc()
      is unsafe in a UNIX signal handler).

If we were to move to a task centric model, how would the application
register (link) a task entry (queue) to a specific widget?  It has
been a while since I have played with tasking, so is it possible
(for example) to gain the address of an entry (queue)?  (This is
similar to the idea matching Qt's signals with slots, except we've
introduced a tasking model). Assuming you can't take the address of
a task entry, the only way I can see this working is via a procedure
(callback) that then calls the task entry (a layer proc).

One should note however, that "main loop" hangs are still possible
if you don't plan your task model correctly. For example if one
event takes too long and another comes along before it finishes
(because the user is clicking the button again), the rendezvous
will block until the task is able to accept another request.
To avoid this of course, you could pass off the request to a
separate task, but then you'd have to manage the backlog that an
impatient user might create by hammering a button repeatedly.

I am having a little trouble picturing how this tasking model
can be done, with my limited experience with tasks in Ada.
Would you be able to use a entry "family" number to link
these together dynamically by use of the number? I'll have
to dig out my tasking book tonight.

I am intrigued by this idea.. just trying to picture a practical
implementation of it.

-- 
Warren W. Gay VE3WWG
http://home.cogeco.ca/~ve3wwg




  parent reply	other threads:[~2003-02-21 18:02 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-16 10:19 [OT] Best way to isolate a GUI? Jano
2003-02-16 14:47 ` Ed Falis
2003-02-16 14:49 ` Victor Porton
2003-02-17 20:52   ` Jano
2003-02-16 16:36 ` Robert C. Leif
2003-02-17  8:44   ` Preben Randhol
2003-02-17 16:22     ` Robert C. Leif
2003-02-17 17:30     ` Jeffrey Carter
2003-02-17 17:54       ` Warren W. Gay VE3WWG
2003-02-17 19:06         ` Randy Brukardt
2003-02-18  3:15           ` Warren W. Gay VE3WWG
2003-02-18 16:14             ` Robert C. Leif
2003-02-18 18:10             ` Randy Brukardt
2003-02-18 21:12               ` Warren W. Gay VE3WWG
2003-02-18 23:20                 ` Randy Brukardt
2003-02-19 18:28                   ` Warren W. Gay VE3WWG
2003-02-20 19:39                     ` Randy Brukardt
2003-02-20 21:34                       ` Warren W. Gay VE3WWG
2003-02-20  7:50                   ` Dale Stanbrough
2003-02-19 12:49                 ` Marin David Condic
2003-02-19 18:35                   ` [OT] Best way to isolate a GUI? (The final concensous?) Warren W. Gay VE3WWG
2003-02-20 12:40                     ` Marin David Condic
2003-02-20 13:13                       ` Dmitry A. Kazakov
2003-02-20 22:01                       ` Warren W. Gay VE3WWG
2003-02-21  1:25                         ` tmoran
2003-02-21  2:08                         ` Marin David Condic
2003-02-21 17:27                           ` Jeffrey Carter
2003-02-22 14:10                             ` Marin David Condic
2003-02-21 18:02                           ` Warren W. Gay VE3WWG [this message]
2003-02-22 14:49                             ` Marin David Condic
2003-02-22 22:50                               ` tmoran
2003-02-23  5:18                               ` Robert C. Leif
2003-02-24 18:06                               ` Warren W. Gay VE3WWG
2003-02-25  1:20                                 ` Robert C. Leif
2003-02-25 17:57                                   ` Warren W. Gay VE3WWG
2003-02-25 12:41                                 ` Marin David Condic
2003-02-25 13:32                                   ` Ole-Hjalmar Kristensen
2003-02-25 17:33                                     ` [OT] Best way to isolate a GUI? (The final fronteer?) Warren W. Gay VE3WWG
2003-02-20  8:26                   ` [OT] Best way to isolate a GUI? tmoran
2003-02-20 12:51                     ` Marin David Condic
2003-02-20 18:47                       ` tmoran
2003-02-17 19:31         ` tmoran
2003-02-18  1:37         ` Jeffrey Carter
2003-02-18  3:39           ` Warren W. Gay VE3WWG
2003-02-18 23:36           ` Randy Brukardt
2003-02-18 13:29         ` Marin David Condic
2003-02-18 18:01           ` Warren W. Gay VE3WWG
2003-02-19 13:06             ` Marin David Condic
2003-02-16 17:25 ` achrist
2003-02-16 21:24 ` Bobby D. Bryant
2003-02-16 21:52 ` David Marceau
2003-02-17  0:57 ` Re; " tmoran
2003-02-17  7:25   ` Jano
2003-02-17 14:09     ` Bobby D. Bryant
2003-02-17 21:12       ` Jano
2003-02-18  7:24         ` Jean-Pierre Rosen
2003-02-18 13:08 ` Marin David Condic
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox