[Gambas-user] About Gambas naming convention
Cedron Dawg
cedron at exede.net
Mon Mar 18 16:55:51 CET 2019
As the originator and main contributor of that thread, I would say don't bother. There is too much mud wrestling and not very much resolution.
I was just about to post a long follow up in fresh thread with a comparison between the two approaches. Instead, if there are no objections, I think I will polish it a bit more and post it to Gambas.ONE where it can be discussed in a forum context.
Having this list will help a lot.
Ced
----- Original Message -----
From: "Benoît Minisini" <g4mba5 at gmail.com>
Hi,
I didn't read all the mails, not enough time. :-)
The Gambas naming convention is not really mandatory at all. It comes
from the way I wrote Visual Basic code when I was using Visual Basic in
my job, plus the decision to use "$" to make the difference between
local variables and private static variables.
I didn't even write the wiki page about naming convention.
I think that naming convention is necessary but is mainly a matter of
personal taste. I use with Gambas some sort of hungarian notation, but
not at all when writing C, C++ code.
I was thinking why I'm using that convention, what the rational is
behind it, and here is the result of my thought:
1) The name of a variable tells what is stored inside.
2) Why adding a prefix? To tell how the thing stored in the variable is
represented: by a number, by a string, by a reference to a Gambas object.
3) Why telling that a variable is an array or a collection? Because
these data structures are often used for moving from the representation
of a thing to another representation of the same thing, or a
representation of another thing. So it's important to notice.
4) Why using specific prefix for controls? No real reason there, it's
just comes from an old Visual Basic habit.
5) Why not using prefix for global variables? No real reason too, except
that it's nicer to look like other global symbols like methods or
properties.
As you see, if you are looking for coherency, you can move on.
It's just easier that code introduced in the Gambas source tree follows
this convention so that everybody can read the code without having to
learn ten different naming conventions.
The more important for me, is chosing good names for symbols. Especially
when they are public. Not too short, not too long, informative enough so
that commentaries are not needed (this is not always possible, but the
less comments are needed, the best it is).
Regards,
--
Benoît Minisini
----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
More information about the User
mailing list