Am Freitag, den 16.09.2005, 01:02 +0200 schrieb Soeren Sandmann:
Yaron Tausky <decaycell gmail com> writes:I wish to write a GNOME IM client -- mainly as a project for myself, I doubt if would be interested in my code -- yet I'm not quite sure about the architecture. GObject seems VERY complicated, and I couldn't find any tutorial about it beside the included documentation. Should I structure the programme as collection of classes (as in C++) and implement each and every one of them as a GObject?
Yes, that's it. All the objects derive from GObject. It isn't hard at all once you've accomodated to the semantics. Take a look at [1] for a fairly detailed introductory paper.
Should I do it only for key classes, and do the rest (helpers, etc.) in the old fashion C style?
Depends. The protocol parsing stuff is of course totally procedural and not object-oriented at all. Some people write network connection objects that hide away the protocol details, though, and emit signals reflecting high-level concepts. You could for instance have a connection object that emits "user-connected", "user-disconnected" etc. Your guy can then react to these state changes through callbacks.
I wouldn't bother with GObject at all. A simple struct with functions as methods is generally fine:
I disagree with you here, since GObjects can emit signals, and do type checking for their properties. Although I don't know the memory footprint details, pseudo-classes in C are in my opinion usually only handy if you expect many mallocs and/or frees per time unit. [1] http://www.le-hacker.org/papers/gobject/ -- Christian Neumair <chris gnome-de org>
Attachment:
signature.asc
Description: This is a digitally signed message part