Sunday, June 10, 2007

Mini-review of Foundations of GTK+ Development

Foundations of GTK+ Development is definitely recommended for anyone doing any serious GTK+ development. The authors style is easy to read, and the book serves as both a decent tutorial for any programmer fluent in C looking to learn GTK+, and a reference for intermediate programmers who want to broaden their knowledge of GTK+.

The author wisely spends his chapters on the most useful and most often misunderstood parts of GTK+, leaving the hand-holding chapters to a blessed minimum. This means there is little fluff, and a lot of meat. Since its based on GTK+ 2.10, we are able to skip the deprecated, or just plain old crufty parts, and get straight to the modern usages, such as GtkTreeView, GtkUIManager, and Glade. There is even a couple pages on cairo, within the context of GTK+ 2.10's new printer support.

His entire chapter on deriving existing types, and creating new ones (in the often arcane GType system) is sure to be a god-send to beginning programmers, and a well worn reference point for programmers in code mode. Add in the over 100 pages of appendix material documenting GTK+ properties, signals, styles, stock icons, and error types, and you've got a handy resource.

While all the information in the book is available somewhere free online, including the indispensable devhelp, the GNOME website, and even the GTK+ website itself, having a coherent narrative in handy physical form, I think, is worth the purchase.

Even though the book weighs in at over 600 pages, given the degree to which GTK's abstractions leak, I would have liked it if the author spent a little bit more time explaining the design issues that lead to these leaks.

For example, the author briefly mentions GObject's inherent ability to support the Pimpl (pointer to private implementation) idiom, and gives the boiler-plate code to achieve it (which is good). But when reading the code, one notices that MyObject appears to contain no reference to MyObjectPrivate, while the class constructor for MyObjectClass contains the function

g_type_class_add_private (klass, sizeof (MyObjectPrivate));

(which is mysterious, to me at least). If abstractions are going to leak, I would like it if the author could spare a couple sentences to give me an idea why such a call is necessary, if only avoid a mild state of incongruous bewilderment.

Lastly, I would have liked to get a bit more insight into some of the more fringe, but related, technologies, such as cairo or D-bus; and more details into tricker parts like threading, or a full working example of how to integrate foreign sub-systems using Glib. However this may be asking too much for one book, so perhaps we will have to wait for the author to spring "Advanced GTK+ Development" upon us!

No comments: