comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: [OT] Best way to isolate a GUI?
Date: Tue, 18 Feb 2003 12:10:31 -0600
Date: 2003-02-18T12:10:31-06:00	[thread overview]
Message-ID: <v54tl22mbfdaaf@corp.supernews.com> (raw)
In-Reply-To: 3E51A55A.3000101@cogeco.ca


Warren W. Gay VE3WWG wrote in message <3E51A55A.3000101@cogeco.ca>...
>Randy Brukardt wrote:
>> Warren W. Gay VE3WWG wrote in message <3E5121BD.4010200@cogeco.ca>...
>>
>>>For input and output callback arguments, I use a discriminated
record,
>>>which then allows Ada95 checks on record members according to the
event
>>>type (ie. the record variation). This is something I wish GtkAda
would
>>>use.
>>
>> That doesn't work well if you have callbacks which are evolving (as
most
>> real-world GUIs are). Adding a new variant to a record can break
>> existing code (think aggregates, think name conflicts), and will
require
>> recompiling everything in sight.
>
>I don't find this a particularly good argument. I want the code to
break
>if I change the callback requirements, even if just for one event.
>Any structure changes are all localized to the variant
>record, so it is very easy to locate conflicts (or simply let the
compiler
>do it for you). Of course not all variant record violations can be
>detected at runtime (some can however).
>
>As far as "recompiling everything in sight", I feel this is not a good
>reason to avoid it. If a recompile is necessary (which GNAT _can_
determine),
>then let it compile away. This is an automatic process.
>
>Reluctance to recompile suggests that your goals are not in sync
>with the end user's--  ;-)


Most end users that I'm familar with don't want to have to rewrite all
of their programs because we've provided an updated version of the
interface with a few new features. That requires the interface to change
as little as possible. Even adding a parameter can cause problems with
extensions of a type. Adding visible components (which breaks all
aggregates) is simply not acceptable.

>The end goal, IMHO, is to produce a library that provides the best
interface
>to the user; not to be convenient to the library developer ;-)


There is nothing "convenient to the library developer" about either of
these "solutions". The best solution is to not have the problem in the
first place. Thus, we use dedicated action routines (callbacks) whenever
possible. The only place that we use any sort of variable data is in the
lower-level Notification interface, and that's because Microsoft gives
us no choice.

Note that the notification interface in Windows is defined as a set of
overlayed records, using which ever one is appropriate for the current
message. There is no "variant" and certainly no discriminant. And each
new thing Microsoft adds creates a bunch more of these.

The big problem with the variant interface is that everything has to be
defined in one place. That's usually not practical. The notification
data includes various data types specific to each of the types of
controls. If we had to put all of that in the spec. of the Claw root
package, we'd more than double its size (and its already 5000 lines).

We recently completed a project eliminating as much unused stuff from
user programs as possible. If we had used a variant solution, there
would be no possibility of that, as every possible control would have to
be reflected in that variant. Since we used a tagged type, we don't have
to drag in Tree Views unless the user actually withs Claw.Tree_View.
(That was happening for another reason, and the internal restructuring
eliminated that.) That cut the average size of Claw programs by 500K.

>The X11 software (a real world GUI, BTW) uses a finite number of
members
>in the XEvent union (albiet in C, and certainly inferior to any Ada95
>variant record).  This model has been well proven and works well. The
>bonus is, that if you insist on a very general structure, this too can
>be accomodated in a variant record with a system.address or some such
>kludge. But at least that kludge is optional, and perhaps temporary as
>your GUI evolves to perfection.


If you're mapping an existing union, you're way ahead of the game. But
that's a pretty limited GUI (and calling X11 a GUI is a stretch).
Windows doesn't work this way, and I doubt that many of the higher level
GUIs built on top of X11 do, either.

                 Randy.





  parent reply	other threads:[~2003-02-18 18:10 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 [this message]
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
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