Re: syntactic sugar vs. design



On Wed, 28 Feb 2001, Andrae Muys wrote:

> I must admit that coming from an engineering background I can't help but
> think of vectors and ordered-pairs as fundamental types :).  Hence I
> don't have a problem with them.  Granted they can be abused by lazy
> developers, but then again Strings are already being abused worse than

The difference is vectors and ordered-pairs are not atomic - so when you
want a vector of complex types, you'll give yourself nightmares, or have
to have two cases for dealing with vectors.  Strings may be abused, but
that's an application developer's problem, not a data model problem.

>     GNode *tree = gconf_get_tree("/apps/myapp/colour");
>     Colour colour;
>     colour.r = gconf_tree_get_int(tree->children);
>     colour.g = gconf_tree_get_int(tree->children->next);
>     colour.b = gconf_tree_get_int(tree->children->next->next);

The problem with this is it now relies on the ordering of r, g and b in
the data, requiring either more work from the application, to ensure the
node you expect is the node you get, or more work in the engine, to ensure
nodes are at the very least returned in the right order, and only the
nodes you want are returned, and that all the nodes you want are
returned.

I'm not sure what gains a tree interface would offer over accesing "r",
"g" and "b" directly?

-- 
bje





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