For the past year I have timidly been trying to make the transition from
text-only to GUI programming. Event driven programming, and graphical
interfaces have required a much different mindset for me than any programming
I ever did before. I have found it a difficult switch. I found that the
Signal Processing, Graphics, and User Interfaces classes in the CS department
have helped a lot. In spite of having some limited success, I still find
GUI's painfully hard. Here are some brief words of advice (YMMV):
I find IDE's complicate learning to use a UI toolkit more than they simplify.
Ditch the fancy IDE until after you understand the toolkit, then you can
leverage its automating functions.
Stick with one toolkit long enough to give it a real chance. For me, that
means at least one complete middle sized program. If you don't really
understand the toolkit, you can't leverage what you have learned when you
approach another toolkit.
Tinker with your GUI. Try the various features that your toolkit has to
offer.
Understand that each toolkit solves the same problems in very different ways.
If you bounce from toolkit to toolkit quickly before you understand the
fundamental problems, you will end up very confused (my headache is still
wearing off). Some problems you will need to think about include:
how to handle events,
how to determine the size of graphical elements and lay them out
correctly
even when a window is resized,
how to have a generic widget interface with a specific class's data,
the build process for compiling and linking executables,
memory management,
how to interface with currently unknown pieces of hardware and
software,
how to display persistent data on a non-persistent interface,
how to interact with the user,
how to handle portability across platforms,
and others that my mind is too numb to articulate at the moment.
When you are programming a GUI, realize that you need to program the drawing
of every element on the screen every time anything changes. You have to
figure out how to compute it's location, size, and orientation. No toolkit
will do this for you; they may try but will usually do it incorrectly. When I
realized this, things got much easier.
My biggest problem with GUI programming was assuming that elements of the UI
would be taken care of for me. Once I realized that there is some pretty low
level graphics and system programming involved in GUI's, I really started to
think about how to implement everything myself. Once I got into this mindset,
I finally started to figure out how to use some toolkits. The toolkit is to
help you do things that you could otherwise do, but wouldn't want to
repeatedly implement. You have to fill in all the gaps in functionality, and
often it is easier to write it from scratch than to force a prefabricated
library or class to do the job.
I have had some success with both QT and Swing GUI's. I find their
documentation very complete, and they both have some good tutorials aimed at
newbies. They both have their downsides though; I don't think I've found my
toolkit nirvana yet. I tried GTK but couldn't find any really good
introductory tutorials. I hear that GUI's are easy in Objective C (check out
GNU-Step), Ruby, and Python. I've been sticking with Java/C++ so far though.
I think I'll try wxWindows next.
Good luck, and let us know what you decide to try and why.
Richard Esplin
On Wednesday 10 December 2003 21:00, Ross Werner wrote:
> Almighty Wise and Perspicacious UUG Members,
>
> For most of the things I've wanted to program, command-line interfaces
> have been sufficient. If I ever needed some sort of GUI, a web-based PHP
> interface worked peachily. However, I've now run into a case where I think
> I need to learn how to program some sort of GUI... Reader's Digest
> version: I want to create interactive card games that you can play with
> others over the network (think Microsoft Hearts). PHP just won't cut it in
> this situation, as much as that grieves me. *sigh*
>
> So, I turned to the programming language I know second-best--Java. After
> playing frustratedly with the source code for Swing demo applets for hours
> on end with no results, I gave up. Now I turn to you: what do you people
> use to program GUIs? Java Swing? Gtk? Qt? Perl-Tcl/Tk? What would be the
> easiest to learn? Are GUIs really as painful to program (especially
> without a fancy IDE) as I've heard? Are there resources to help clueless
> newbies like myself? Or do I just have to wait until CS Whatever, GUI
> programming?
>
> Thanks a ton in advance,
> ~ ross
____________________
BYU Unix Users Group
http://uug.byu.edu/
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list