[Gtk-sharp-list] MonkeyGuide?: Hello World in GNOME.NET - Second Draft

Mike Kestner mkestner@speakeasy.net
16 Feb 2003 23:29:42 -0600

On Sun, 2003-02-16 at 13:11, Charles Iliya Krempeaux wrote:

> > I don't think anything is really gained by subclassing Gnome.Program.
> > The only reason I can think of to subclass Program in an application
> > would be to add complex or lengthy argument handling.
> I disagree.  IMO, this is the way a GNOME application should be created.
> (I.e., all GNOME applications should subclass Gnome.Program.) 

Only if they are substantially augmenting its functionality.  Your
example is intended to be simplistic for demonstration purposes, but the
subclassing of Gnome.Program in it only *adds* to the amount of code
written, for no substantial benefit.  Using subclassing just for the
sake of subclassing is not good practice.  

In the C API, GnomeProgram derives from GObject, so it can be subclassed
in C.  I am not aware of any C-based applications that subclass
GnomeProgram. Nautilus doesn't.  Evolution doesn't.  Gnumeric doesn't.
These flagship GNOME applications make extensive use of the
object-oriented paradigm through GObjects yet see no advantage to
subclassing GnomeProgram.   

> *cough* *cough*  That's why I created that patch for 
> "gnome/Program.custom".  That way I could "override" the Run()
> method, and do even more polymorphism.  (It seems stupid that
> I have to create a new method called run() to take the place
> of Run().)

I've been mulling over whether I think it's a good idea to include
this.  To be honest, I'm more inclined to remove the Gnome.Program.Run
() and Quit () methods than to make them virtual.  They provide zero
additional capability over Gtk.Application.Run and Quit and their
presence in the Gnome.Program class has only managed to infuse confusion
as to the purpose of the class.  It is not a mainloop management class. 
It is a library initialization and argument parsing helper.

> That way the reader could still learn about this.  While the first
> tutorial would only contain the very basics.
> What do you think??

Sounds good to leave the more complicated aspects to a "beyond the
basics" tutorial.  It would be great to have a "template" project to
help people get started with their own projects.  Sample makefiles,
GConf usage, libglade UI loading via resource files, etc...

> Putting stuff inside the GNOME Application Window is something I'm 
> planning for a future separate tutorial.  (I wanted a separate tutorial
> that would focus on the .Contents attribute.)
> I want each tutorial to take very simple steps.  That way a beginner
> programmer could get started with GNOME.NET.  (And not just someone
> who is simply a beginner at Gtk#.)

Sounds great.  

Mike Kestner <mkestner@speakeasy.net>