[gtkada] Complexity of GUI programming and occasional programmers!

Didier Utheza ddutheza at bu.edu
Mon Aug 20 00:27:00 CEST 2001


Hello,
I would like to open this topic with the GtkAda and the JEWL library in
mind. The JEWL is for beginners in GUI programming. Technically most of
the methods are of a declarative type and the complexity of the GUI is
hidden from trhe user. GtkAda is to GUI what assemblor is to the
programming language. It is a set of elemantary API. The library is well
done, the main problem is that you cannot use it efficiently if you have
no basic knowledge of the implementation of a GUI. A little bit like if
you learn a specific assemblor code without a minimalknowledge of the way
the processor works and its interface with the rest of the machine. You
can still learn the code but it will be much harder.
So the problem is not GtkAda, but the lack of a manual in the literature
for the general public on the implementation of a GUI on a programmer
point of view (even if the code is in C). I never found such a book. Most
books on the topic are too specialized and concentrate on a specific
progamming language.
About Gtk (C), the book from Axel Schreiner: Object Oriented Programming
in C, is very useull tp understand the callback methods and the way Gtk
is implemented. Its price is reasonable (free and in pdf format at:
			http://www.inf.uos.de/axel/
Its target however is for Unix/Linux machines (it may work with gcc for
win$).
One question I would have for the GtkAda developers is about real time
system in Ada/GtkAda and the way the GUI manage the collection of the
objects? Is there any real-time penalty?

Now, the interesting part with JEWL is the way you ask the GUI to draw an
object. The drawback, of course, is the limitations which are necessary
for such a tool that is addressed to beginners (as a beginner, I think it
is a nice way to start learning GUI).
But this concept: programming GUI with declarative code, has been
implemented by professional using c++ and logic++ (an implementation of
Prolog in c++) for a program used in an hospital that deals with checking
patients in and out in relation to their status and the number of room
avalaible. The system is distributed, was initaialy written completely in
c++ (included the GUI). They had to rewrite the program and opted for
another solution to write the GUI that was complex and in consequence
unmanageable with the OOP concept. They conceived logic++ as a declarative
engine that was directly plugged to c++ (its syntax is similar to Prolog,
but the code compile directly to c++).
This is similar to the XPCE GUI that has been implemented for Prolog,
bound to several dialects of LISP and to c++. The interface is written in
c and the syntax is similar to Prolog. Writting a GUI-oriented program is
simple for the beginner since you state what you want and the code has to
take care of it, as any declarative language. I have no experience with
logic++ (which seems to be a prioritary thing), but I did use XPCE and you
can write anything very easily. The complexity of the GUI (its API) is
hidden by the GUI-code.
So, to come back to the c++/logic++ project (I have the paper somewhere in
my mess, but of course since I need it for the references, I cannot find
it), their conclusion was that the development of the GUI with the
declarative logic++ was shorter, clearer and easily maintainable. Which
contrasted with the spaghetti code of the OOP c++ code: difficult to
analyse, so to maintain; long to write and to debug. from what I
understood, the program was correct for soft real-time application (the
reason to develop logic++ that compile directly to c++). The size of the
hybrid program compare to the previous pure c++ one was a little bit
larger but run faster, thanks to a better designed interface.

To conclude and in relation to Ada, developping GUI interfaces poses some
problem. Is GtkAda code manageable with large and complex programs and
suitable to real time projects that need to interface with humans (I have
no idea, this is a genuine question).
What do you think about logic++ and XPCE
(http://www.swi.psy.uva.nl/projects/xpce/download.html)? XPCE could be
used directly by Ada. The project is open (free and source code
available). Finally, how will you compare GtkAda and XPCE in terms of
efficiency (execution time, real-time safety) and ease of implementation
(conception phase to code implementation and manageability)?

On a similar chapter, Eiffel (ISE Eiffel more precisely) is attacking the
real-time market, they also introduce the notion of agents. This brings to
Eiffel possibilities in the declarative domain that could be used
efficiently in GUI programming. Like the notion of pre and post-conditions
(adapted from Z by Meyer, I know), the notion of agents could be
incorporated in Ada (if not limited to hard real-time applications). But
this topic is off the GtkAda concern.

(Note: I do not meant to replace GtkAda with XPCE. XPCE just interfaces
the user to the API (those of GtkAda for example) in a transparent way).
Thanks for reading this post to the end, I hope it will open some
interesting discussion about GUI programming.
			Didier Utheza. 






More information about the gtkada mailing list