comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.not.jrcarter@acm.not.spam.org>
Subject: Re: Custom model in gtkada?
Date: Thu, 29 Jun 2006 20:08:07 GMT
Date: 2006-06-29T20:08:07+00:00	[thread overview]
Message-ID: <HqWog.1048852$xm3.717438@attbi_s21> (raw)
In-Reply-To: <ud5cryj2m.fsf@nasa.gov>

Stephen Leake wrote:
> 
> I disagree. I only click on one thing at a time.

What is your program doing when you click? The concurrency comes from 
programs needing to do something else and respond to user events at the 
same time, which is a fairly common situation. That's easy to do with a 
concurrent language and a GUI library designed for concurrency. With a 
sequential language and sequential thinking, you get the typical C-style 
callback design, in which the GUI takes over the single thread of 
control, and you get other things to happen when you're not responding 
to user events through "idle functions".

> I'm not sure what you mean by "locality" here.

Locality is a basic SW-engineering principle. You should be familiar 
with it. It basically says that everything specific to understanding 
something should be located together. You should only have to look at 
one package spec to understand all the operations of a type declared in 
that spec, for example.

> Not in a well designed GUI framework; the window object is a parameter
> to the callback; no globals.

The window object is not the state of the program. Knowing how the 
previous event with widget X affects the program's response to this 
event with widget Y is the state.

> You simply mean "unfamiliar". That is a function of time spent learning.

No, I mean "intuitive". The standard imperative program model, in which 
the program is in control, and which almost everyone learns 1st, is 
intuitive. People grasp it easily; it corresponds to their understanding 
of how active entities function in the world. The callback model is more 
difficult to understand because it's not intuitive.

> You are saying "each window should have its own thread of control".
> That's way overkill.

No, I'm saying each window may have its own thread of control. For many 
programs, a single thread of control is sufficient. For others, there 
may be a need to update each window continuously. In such a case, each 
window having its own task is not overkill.

In the mid-1980s I considered how to implement a windowing system in 
Ada, and decided event queues were the simplest and clearest approach. I 
then used actual windowing systems, with callbacks, and saw nothing to 
change my mind. I've used CLAW, which uses type extension and 
overriding. When I used JEWL, which has an event queue, it was much 
easier to use. This is in part because JEWL is a simple windowing 
library, without the power and complexity of more complete systems. But 
it's also in part because, despite my familiarity with callback 
libraries, the event-queue model is simpler and more intuitive.

Don't take my word for it, though. Implement a few (not-too) simple 
using JEWL and your callback library of choice, and see what you think.

-- 
Jeff Carter
"I unclog my nose towards you."
Monty Python & the Holy Grail
11



  reply	other threads:[~2006-06-29 20:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-13 18:01 Custom model in gtkada? Dmitry A. Kazakov
2006-06-13 19:53 ` M E Leypold
2006-06-14  7:17   ` Dmitry A. Kazakov
2006-06-14 21:00 ` Maxim Reznik
2006-06-15  7:38   ` Dmitry A. Kazakov
2006-06-15 15:31     ` Georg Bauhaus
2006-06-15 16:24       ` Ed Falis
2006-06-15 18:44         ` M E Leypold
2006-06-15 16:25       ` Dmitry A. Kazakov
2006-06-17 15:13         ` Georg Bauhaus
2006-06-17 16:44           ` Dmitry A. Kazakov
2006-06-22  7:16             ` Emmanuel Briot
2006-06-22  8:31               ` Dmitry A. Kazakov
2006-06-22 12:08                 ` Emmanuel Briot
2006-06-23 12:32                 ` Stephen Leake
2006-06-23 13:58                   ` Dmitry A. Kazakov
2006-06-29 17:11                     ` Stephen Leake
2006-06-30 12:29                       ` Dmitry A. Kazakov
2006-07-02 15:17                         ` Stephen Leake
2006-07-03 18:23                           ` Dmitry A. Kazakov
2006-07-04 13:51                             ` Stephen Leake
2006-07-05 13:06                               ` Dmitry A. Kazakov
2006-07-06  7:10                                 ` Stephen Leake
2006-06-23 16:59                   ` Jeffrey R. Carter
2006-06-23 17:37                     ` Ed Falis
2006-06-23 18:11                     ` Dmitry A. Kazakov
2006-06-29 17:20                     ` Stephen Leake
2006-06-29 20:08                       ` Jeffrey R. Carter [this message]
2006-06-30 10:28                         ` Alex R. Mosteo
2006-06-30 16:07                         ` Stephen Leake
2006-06-30 19:45                           ` Jeffrey R. Carter
2006-06-30 22:41                             ` Randy Brukardt
2006-07-01  5:11                               ` Jeffrey R. Carter
replies disabled

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