comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: A community Windows binding
Date: Sat, 09 Oct 2004 06:23:41 GMT
Date: 2004-10-09T06:23:41+00:00	[thread overview]
Message-ID: <NtL9d.207514$MQ5.165379@attbi_s52> (raw)
In-Reply-To: 9JI9d.213784$D%.188112@attbi_s51

>> system. You have to write little pieces of code that can be invoked in
>> any order at any time outside your control. You have to use global
>> variables extensively for these little pieces of code to communicate.

>For example: in windows a reference to an object may be associated with
>a window.  The message handling routine has access to the window, and
>likewise the reference to the object.  Nothing is global.
  In Windows *all* events are associated with a window (whether it makes
sense or not).  In a system using dispatching like Claw, you declare, eg,
   type This_Window_Type is new Basic_Window_Type with record ...
and the window of This_Window_Type is passed to the dispatched routine,
which has access to the contents of the record extension.  Nothing need
be global.

>> The code is difficult to read because you have to understand all these
>> little pieces to understand any part of the software.
  It does force you to think in an OO way:  you must think about the type
This_Window_Type ...  and its behavior independent of anything else.  What
should a This_Window_Type do when the user asks to resize it?  What should
it do when there's a redraw request (perhaps some data has been changed
and the redraw should show the updated data).  What should happen when the
mouse is moved or clicked in the window?
  Ideally, you will be creating (or using) a new reusable object.  For
instance, in Orbitals (www.adapower.com/os/orbitals.html) there's a
reusable window that displays in 3-D a set of points, rotated by mouse
movement.  The rest of the program, or any program using
  type Cloud_Display_Type(Max_Particle_Count:  Positive)
    is new Claw.Basic_Window.Basic_Window_Type with private;
need know nothing about displaying or stereo projection or tracking mouse
movements or resizing windows.  The total required external interface of
the type is open, close, and set data values.  Yes, at a higher level of
abstraction you need to think simultaneously about calculating the point
data and about displaying it, but you can focus on each of those quite
separately.

>> With an event queue approach, one writes standard imperative software
>> using your standard imperative language (Ada's about the only one). The
>> code is well structured and easy to read and understand.
  A windows interface is user-driven: the user can click or key in any
order at any time outside your control.  So the event queue approach
turns out to be
  loop
    case Fetch_Next_Event is
      when resize => ...
      when keyin  => ...
      when draw   => ...
A dispatching system like Claw simply makes that internal and each "when"
branch consists of a dispatching call to, eg, When_Resize, for that Type
of window.  Given the number of different events ("case" branches) and the
possible different kinds of windows (implemented by "if" or subsidiary
"case" statements in each branch), explicitly writing the event queue code
for any non-trivial program would be truly huge and ugly.



  reply	other threads:[~2004-10-09  6:23 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <usm8shkul.fsf@acm.org>
2004-10-05 23:28 ` A community Windows binding Stephen Leake
2004-10-06  4:26   ` David Botton
2004-10-06 17:42     ` Jeffrey Carter
2004-10-07 16:33       ` Warren W. Gay VE3WWG
2004-10-07 17:37         ` Jeffrey Carter
2004-10-08  2:39           ` Alexander E. Kopilovich
2004-10-08  2:43           ` Nick Roberts
2004-10-08  4:56             ` tmoran
2004-10-08 23:17             ` chris
2004-10-09  1:31             ` Jeffrey Carter
2004-10-09  1:36             ` Jeffrey Carter
2004-10-09  3:15               ` Steve
2004-10-09  6:23                 ` tmoran [this message]
     [not found]                 ` <z7ybd.26154$hk6.998363@news20.bellglobal.com>
2004-10-15  1:12                   ` Stephen Leake
2004-10-15 20:36                     ` David Botton
2004-10-17 13:25                       ` Stephane Riviere
2004-10-09 13:20               ` Stephen Leake
2004-10-10  9:04                 ` CBFalconer
2004-10-10 14:39                   ` Stephen Leake
2004-10-14 16:54                     ` Warren W. Gay VE3WWG
2004-10-14 16:53                   ` Warren W. Gay VE3WWG
2004-10-10  3:38               ` David Botton
2004-10-14 16:46             ` Warren W. Gay VE3WWG
     [not found]           ` <rSftVP19_F@VB1162.spb.edu>
2004-10-08  8:18             ` Marius Amado Alves
2004-10-08  1:36         ` Stephen Leake
2004-10-06  4:28   ` CBFalconer
2004-10-06  6:02     ` tmoran
2004-10-06 11:35     ` Georg Bauhaus
2004-10-06 14:04       ` Steve
2004-10-06  6:22   ` Fionn mac Cuimhaill
2004-10-06 17:18   ` Nick Roberts
2004-10-07  6:38   ` Frank Piron
2004-10-07  9:44   ` Ross Higson
2004-10-07 16:39     ` Warren W. Gay VE3WWG
2004-10-07 22:27       ` Ross Higson
     [not found] <41664D4E.7040405@netcabo.pt>
2004-10-08 21:38 ` Alexander E. Kopilovich
     [not found] <uacv0hhj0.fsf_-_@acm.org>
2004-10-10 18:05 ` Stephen Leake
2004-10-10 18:17   ` Andre
2004-10-10 20:55     ` tmoran
2004-10-11  0:34   ` David Botton
2004-10-11  0:39   ` David Botton
replies disabled

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