Re: Bonobo UI code feedback
- From: Jon K Hellan <hellan acm org>
- To: Darin Adler <darin eazel com>
- Cc: Michael Meeks <michael helixcode com>, Gnome Components <gnome-components-list gnome org>
- Subject: Re: Bonobo UI code feedback
- Date: 18 Oct 2000 22:32:39 +0200
Darin Adler <darin eazel com> writes:
> Using strings for the property names in calls like *_set_prop may be handy
> for the implementation, but it's a nightmare for clients. It means that many
> errors that should be caught at compile time instead aren't seen until
> runtime. We've seen demonstrations of how error-prone programming this way
> is, for example with all the runtime warnings about "command/widget
> separation". If there were at least covers for common use, the API would be
> a lot easier to use correctly.
>
> The same problem applies for using strings for property values. It's easy to
> get the wrong result with a typo, rather than getting a compile that fails.
> This is a problem for future expansion, because idiosyncrasies about how
> strange strings are handled may be coded into applications without the
> programmer realizing it.
Xt and Motif half solved this with macros in the header files. E.g:
#define XtEtextResizeNever "never"
#define XtEtextResizeWidth "width"
#define XtEtextResizeHeight "height"
#define XtEtextResizeBoth "both"
There are preprocessor macros for all correct strings. It's still
possible to write strings directly, and those may contain typos. But
when programmers get used to using the macros, most typos will be
caught by the compiler.
Regards
Jon Kåre
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]