From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Properties
Date: Thu, 2 Dec 2010 22:24:18 -0600
Date: 2010-12-02T22:24:18-06:00 [thread overview]
Message-ID: <id9rdk$esp$1@munin.nbi.dk> (raw)
In-Reply-To: 18768dde-5817-40b9-aaa1-03c620ad7187@i32g2000pri.googlegroups.com
"Maciej Sobczak" <see.my.homepage@gmail.com> wrote in message
news:18768dde-5817-40b9-aaa1-03c620ad7187@i32g2000pri.googlegroups.com...
...
>You might argue that by analogy two tasks should be able to modify the
>content of two distinct widgets, but that would be stretching
>definitions, as the agreement of what is "distinct" in GUI is quite
>arbitrary (ultimately, everything is a "child" of some uber-container,
>like a display and shares, so nothing is really distinct).
I wouldn't *argue* that, I'd say it ought to be a fact. And it is in Claw...
I'd also suggest that the Standard screwed up with Text_IO. It should have
some guarantee of sanity for writing to Standard_Output (no erroneous
execution, but no requirements of ordering, either). In practice, this is
the case; I'm not aware of any Windows hosted compiler that really does
anything weird with these Put_Lines.
Robert Dewar has noted in the past that there are two kinds of erroreous
execution: those where truely bad things will happen, and those that are
erroneous in name, but in practice will work fine. Put_Line is a clear case
of the latter. (Almost every Ada program is full of such cases, at least in
the runtime.)
...
>I have implemented a GUI application recently. Not in Ada, but the
>general concepts are transferrable, as the tasking constraints were
>the same.
>The design involved a separate encapsulating "gui" package that
>exposed subprograms for *logical* (ie. domain-level) manipulations of
>the displayed content. The actual domain-oriented tasks of the
>application were not concerned with "setting a new text value of some
>widget", but rather with updating the domain-level information,
>whatever it was. By doing this, I have achieved not only the physical
>encapsulation of the display part and loose coupling between
>functional modules (heck, I could change that to a web service without
>touching anything else), which solved the tasking constraints, but
>also raised the level of operation for the rest of the program. And I
>don't consider it to be "obtrusive".
It's not "obtrusive", but what it is is serializing. Essentially, all of
your tasks have to line up to get their data updated. Depending on how much
data they need to display, that can effectively block them from getting
anything significant done. (I've had problems like this with logging
facilities in our web server.)
The result is that gauges don't update when input is being solicited, and
sometimes the tasks themselves have to be blocked. It's usually better to
push the serialization to the lowest level (with the shortest execution
times), and that is deep within the GUI, not at the top level.
Now, I agree that most GUIs simply don't work with tasking; to get Claw to
work with it requires lots of locks internally, since Windows doesn't like
multiple threads doing I/O.
> With this experience in mind, if you insist on GUI to be task-safe, I
> think it is because you want the GUI library to support poor design
> practices. Having arbitrary application tasks calling Set_Text
> directly on some widget sounds like spaghetti.
> And that's why I'm not convinced.
Fair enough, although I don't really agree. First off all, all GUI code is
spaghetti (it's the nature of event-driven programming); it doesn't really
matter how you do it. (If there was a better alternative to using
event-driven systems, I'd suggest using it, but it doesn't exist so far as I
can tell.) Second of all, one design does not fit all. Sometimes you can use
a central data repository as you previously suggested, but it doesn't work
very well if there is a lot of data (because of the need to provide mutual
exclusion on the data, along with the need to give the GUI priority access
to that data) or if the processing time is short compared to the time to
display the data.
I prefer that my GUI framework allow *any* reasonable design, rather than
forcing one into abstractions that may very well just bloat up the code. In
Claw, the usual approach for simple widgets is to put all of the
functionality directly into the widget itself (including any tasking
needed), rather than artifically separating the data creation from the
display. (Most of the GUI programs I've worked on have had very little data
processing associated with them; indeed, most of them have had completely
separate GUI management programs from the actual server simply because
automatically running programs have to run headless.)
In any case, tasking is a critical functionality for Ada, and one of the
most important differences between it and most other languages. Deciding to
prevent the use of that functionality for one sort of programming is like
cutting off a foot...
Randy.
Randy.
next prev parent reply other threads:[~2010-12-03 4:24 UTC|newest]
Thread overview: 96+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-28 3:21 Properties Shark8
2010-11-28 8:15 ` Properties Dmitry A. Kazakov
2010-11-28 19:43 ` Properties Shark8
2010-11-29 8:34 ` Properties Dmitry A. Kazakov
2010-12-01 18:15 ` Properties Shark8
2010-11-28 12:37 ` Properties Georg Bauhaus
2010-11-28 21:22 ` Properties Shark8
2010-11-29 16:54 ` Properties Georg Bauhaus
2010-12-01 19:52 ` Properties Martin Krischik
2010-12-01 23:24 ` Properties Georg Bauhaus
2010-12-05 16:15 ` (placepo) Properties Martin Krischik
2010-12-06 23:24 ` Shark8
2010-12-01 23:31 ` Properties Georg Bauhaus
2010-11-30 1:49 ` Properties Randy Brukardt
2010-11-30 16:58 ` Properties Charmed Snark
2010-11-30 17:22 ` Properties Dmitry A. Kazakov
2010-11-30 20:27 ` Properties Warren
2010-12-01 8:39 ` Properties Dmitry A. Kazakov
2010-12-01 15:21 ` Properties Warren
2010-12-01 15:59 ` Properties Dmitry A. Kazakov
2010-12-01 16:20 ` Properties Warren
2010-12-01 18:22 ` Properties Dmitry A. Kazakov
2010-12-01 19:36 ` Properties Shark8
2010-12-01 21:13 ` Properties Dmitry A. Kazakov
2010-12-01 21:35 ` Properties Maciej Sobczak
2010-12-01 21:45 ` Properties Dmitry A. Kazakov
2010-12-02 9:57 ` Properties Maciej Sobczak
2010-12-02 10:26 ` Properties Dmitry A. Kazakov
2010-12-02 15:25 ` Properties Maciej Sobczak
2010-12-02 15:46 ` Properties Dmitry A. Kazakov
2010-12-02 21:11 ` Properties Maciej Sobczak
2010-12-02 22:19 ` Properties Dmitry A. Kazakov
2010-12-03 4:43 ` Properties Randy Brukardt
2010-12-03 13:53 ` Properties Maciej Sobczak
2010-12-03 21:32 ` Properties Randy Brukardt
2010-12-04 22:13 ` Properties Maciej Sobczak
2010-12-06 23:30 ` Properties Shark8
2010-12-06 23:33 ` Properties Randy Brukardt
2010-12-04 17:43 ` Properties Simon Wright
2010-12-04 20:48 ` Properties Dmitry A. Kazakov
2010-12-04 22:27 ` Properties Simon Wright
2010-12-04 22:31 ` Properties Vinzent Hoefler
2010-12-03 4:24 ` Randy Brukardt [this message]
2010-12-03 5:00 ` Properties Shark8
2010-12-03 21:10 ` Properties Randy Brukardt
2010-12-03 23:34 ` Properties Jeffrey Carter
2010-12-06 6:02 ` Properties Brad Moore
2010-12-06 23:25 ` Properties Shark8
2010-12-01 19:48 ` Properties Randy Brukardt
2010-12-01 21:10 ` Properties Warren
2010-12-02 0:03 ` Properties Shark8
2010-12-02 16:45 ` Properties Warren
2010-12-02 17:32 ` Properties Dmitry A. Kazakov
2010-12-02 20:45 ` Properties Warren
2010-12-02 21:17 ` Properties Adam Beneschan
2010-12-02 21:40 ` Properties Warren
2010-12-03 3:34 ` Properties Shark8
2010-12-03 8:16 ` Properties Thomas Løcke
2010-12-02 20:52 ` Properties Pascal Obry
2010-12-02 19:46 ` Properties Adam Beneschan
2010-12-02 20:38 ` Properties Warren
2010-12-02 21:39 ` Properties Jeffrey Carter
2010-12-02 21:55 ` Properties Warren
2010-12-03 9:33 ` Properties Anonymous
2010-12-03 3:47 ` Properties Shark8
2010-12-03 0:09 ` Properties Robert A Duff
2010-12-03 15:49 ` Properties Warren
2010-12-03 20:07 ` Properties Shark8
2010-12-06 21:01 ` Properties Warren
2010-12-06 23:22 ` Properties Shark8
2010-12-07 14:37 ` Properties Warren
2010-12-08 21:13 ` Properties Simon Wright
2010-12-09 1:21 ` Properties Shark8
2010-12-06 23:43 ` Properties Randy Brukardt
2010-12-07 0:56 ` Properties Jeffrey Carter
2010-12-07 11:23 ` Properties Maciej Sobczak
2010-12-07 11:51 ` Properties Georg Bauhaus
2010-12-07 15:35 ` Properties Maciej Sobczak
2010-12-07 17:02 ` Properties Georg Bauhaus
2010-12-07 14:39 ` Properties Warren
2010-12-03 15:40 ` Properties Warren
2010-12-03 19:56 ` Properties Shark8
2010-12-03 20:12 ` Properties Warren
2010-12-03 5:53 ` Properties Shark8
2010-12-03 9:05 ` Properties Dmitry A. Kazakov
2010-12-03 19:52 ` Properties Shark8
2010-12-03 21:14 ` Properties Randy Brukardt
2010-12-04 5:35 ` Properties Shark8
2010-12-04 14:23 ` Properties Peter C. Chapin
2010-12-04 18:53 ` Properties Shark8
2010-12-13 15:10 ` Properties Brian Drummond
2010-12-03 22:38 ` Properties Dmitry A. Kazakov
2010-12-04 3:12 ` Properties Shark8
2010-12-04 13:19 ` Properties Georg Bauhaus
-- strict thread matches above, loose matches on Subject: below --
2010-12-04 19:53 Properties Shark8
2010-12-04 23:27 ` Properties Thomas Løcke
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox