[Kde-games-devel] Design of Qt and/or KGame based programs, part 1
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Mon Sep 27 13:28:14 CEST 2004
Hi,
> > > c) Not name the slot slotFoo() from the beginning, but just foo()?
I think it really comes down to a question of taste. However, here are three
reasons, why I think it does not make much sense to name slots "slotFoo ()":
1) The fact a certain function is a slot is documented in the API, anyway, and
tools like KDevelop are aware of that - totally independent of how the slot
is labelled.
2) You can really think of a slot as a function like any other, which supports
a certain additional way of invocation. Just like a public member function in
contrast to a private one can be invoked from a different class, a slot in
constrast to a regular function can be invoked using a signal it's connected
to. The mechanism involved is quite different, but practically, it's just
that. And somehow nobody calls their functions protectedFoo (), publicBar ()
etc. So why give slots a special treatment?
3) Names can get misleading. Every once in a while you realize that something
you implemented as a slot never really gets called as a slot in your code and
might just as well be converted to a regular function. Or you find out that
it would be nice to have some method which previously you were calling
directly in your code available as a slot. In those cases you'll have to make
sure you rename the functions in question, or their names will become
misleading.
None of those arguments are particularly striking. Again, it really comes down
to a question of personal taste.
Thomas
More information about the kde-games-devel
mailing list