Re: [Glade-devel] Re: glade code generation



On Wed, 2003-02-26 at 19:21, Jon Cast wrote:
> Owen Taylor <otaylor redhat com> wrote:
> > On Wed, 2003-02-26 at 17:43, Mark McLoughlin wrote:
> 
> > [ Cc'ing glade-devel as a more appropriate forum ]
> 
> > > Hey,
> 
> > > 	I've just had to explain for the umpteenth time to people to use
> > > libglade instead of code generation ... Surely if we're not
> > > recommending that anyone use it, we should just remove it completely
> > > to avoid the confusion ?
> 
> I'm sorry, but I seem to have missed this bit; why shouldn't people use
> glade?

If you generate C code with glade:

 - You get C code which isn't related to how you write code by
   hand. But if you don't know better, you'll copy anyways.
   (Why is this code calling gtk_widget_set_name() and ref'ing
   every widget?)

 - You get the typical code generation problem that once you
   edit it, you risk problems if you generate code again.

 - You get something you can't check into source control reliably.

 - You go to experienced GTK+ programmers for help, and they
   look at you blankly.

Libglade is a development methology we can support, because it
gets used extensively for real apps. There may be full scale
apps using generated glade code, but certainly not many of them.

> > Makes sense to me; we had
> 
> >  Don't use glade to generate code, use libglade!
> 
> > As the /topic in #gtk+ for a week or so, and there were a ton of
> > people coming in, seeing the topic and asking about it because they
> > had been struggling with glade's generated code.
> 
> Is there an archive for #gtk+?  I'd like to read this.

Not unless someone happened to be logging it. 

> Yeah.  Note that for some languages (such as my favorite, Haskell),
> using libglade is painful enough to suggest a need for another code
> generator to handle all the cruft :)

Can't really comment here. I've never quite figured out how
one does GUIs in a functional language.

> > but I think the same basic principle applies there. If you don't have
> >  excellent IDE integration, you don't want to generate code. Maybe not
> >  even then.)
> 
> Somebody better tell the bison & flex folks; I think they've missed
> this somehow :)

Imagine how much of a disaster yacc would be if the way you used it
was to edit the generated yyparse.c. That's what generating code
with glade is.

The comment about IDE integration is basically that if the source
code editing is integrated with the widget editing, then things 
can work better:

 - You can click on a widget, and edit its callbacks
 - Source code editing is relatively constrained, because the
   tool you are using to do it knows about the GUI.

This is how things like Visual Studio get away with it, I think.

Regards,
                                           Owen





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]