[Xcb] Reply Buffering Question

Barton C Massey bart at cs.pdx.edu
Sat Nov 17 15:24:17 PST 2007


In message <20071117171644.GE26472 at suckless.org> you wrote:
> Long function names don't lead to bad code, they are. In the C
> world we don't suffer from them so much historically spoken,
> because C programmers tend to use snappy but well-choosen names
> for functions. Well, but as a bad example see this[1](*):
> 
> In The Practice of Programming (which is a MUST for any C
> programmer) a whole chapter has been written about naming
> conventions, which has heavily influenced the C world since the
> 80s. And I agree on them, they are some good examples in
> contrast to the other link.

Long function names aren't crappy code in this case, they're
the result of a crappy programming language.  In C++ (which
don't get me wrong, I absolutely abhor in general), Java, or
Haskell we would use namespaces and scoping to clean up most
of these ludicrously long names.  In C, we're stuck with a
single flat namespace for programs that may require a
zillion libraries that need to be extensible, so we do what
we can.  The C world hasn't suffered from this so much
historically, because there hasn't been much out there in
the way of things to collide with, and APIs have been kept
small, so name choices have been fairly free.  Modern X
negates both these advantages.

I think it's horrible that all of our public functions start
with xcb_ to begin with.  The fact of the matter is that my
principal criterion in choosing that name is that it was a
short collection of random constants that was unlikely to
collide with somebody else's prefix---and I was wrong.  It
also stands for X Cut Buffer.

I'd rather see too-long names than random abbreviations,
random prefixes, misspellings, elided vowels, ambiguous
names, sets of names that "you just have to know" go
together.

If you have a suggested naming convention that would fix the
long names problem in C without introducing any of the
above, I'd be quite interested to hear about it.  Those
generating bindings for other, better languages are
encouraged to use their naming features.

    Bart


More information about the Xcb mailing list