23 Jul 2000 ajt   » (Master)

One thing I hate about GUI programming is how it immediately takes over everything else you want to do. You have to go into funny other programs to design it, and you have to create all these boring structures and whatnot to handle it, and do loops and do a whole lot of boring cruft for no good reason. Your GUI code takes up pages and pages of complicated, boring, repetitive junk and the actual point of your program gets lost.

Take, for example, a form to display a table of numbers on screen. You either have to let glade take over your project, or you have to work out which widgets you want where, and create them, and place them, and make some hboxes and some vboxes and get them all properly organised, and then eventually get on to your actual code.

Compare that to:
for (i=0;i<n;i++) printf("%5d %5d %s\n", x[i], y[i], name[i]);

Why should I have to write more code than that to make it a GUI? If I just want a simple program that lets me display some numbers, and click a button to say whether that's okay or not, and return 0 or 1 depending, why should I have to write more code to make that pretty and GUIfieid than I'd have to to make it work in a terminal?

It's not fundamentally more complicated: sure, there's a lot of stuff going on in the background: drawing the button, and loading the font, and anti-aliasing it, and whatever else; but there's a lot going on in the background with printf() too: going from the program through the xterminal through X through the videocard, and whatever. So why is my code to handle it so much more complicated?

I wonder if something similar to printf for GUI stuff might be possible; so that in the same way you don't have to create little loops to print just the right number of spaces anymore, you don't have to worry about creating the right hboxes and putting them in the right order. So that rather than having to go to paint a picture of how you're GUI will look, or have to tell it exactly how you want it laid out in words of one syllable or less, you can just wave your hands about a bit and have it actually work.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!