Hi Peeps,
Do you have a strong naming protocol? :-What is it?
Do you use all that Hungarian variable stuff?
Thanks
> Do you use all that Hungarian variable stuff?
Used to, but spelling out what type a variable is in the name got agravating after changing the types of a couple variables way back when (it's easier to do now with auto variable renaming in most IDE's, but still a chore)
All I have left of the hungarian stuff was putting a prefix in front of each variable - and even that I've gone with my own system of the following.
p_ for Parameters (A_ if you prefer argument)
l_ for local variables.
g_ for global variables
m_ for module level variables (or class level if in a class based system like java)
The main reason I stuck to that was it made life in VB6 much more reasonable, renaming is easy if you stick to using the underscores only for the prefix, no getting the wrong variable in a global search and replace, it allows easily checking the scope of a variable by it's name, and it allows system reservred words for variable names (date is no good for a variable while l_date and p_date are fine in just about everything)
No I use whatever names I feel like, only consistent things I do are that I don't use underscores but rather run words together, use capitals for the first letter in each word.
I have a Base Set of variables, such as:
SCX = Screen Width.
SCY = Screen Height.
PLX or PX = Player X Position.
PLY or PY = Player Y Position.
PLZ or PZ = Player Z position. Which one depends on size of project.
PLPT = Player Pitch.
PLYW = Player Yaw.
PLRL = Player Roll.
It means my code is quite cryptic in some instances but I can still make perfect sense of it. I have to try *hard* To comment my source-files well enough for others to read :)
I try to normalize my functionnames like <Object><Action><Subject>. This way it's easier for me to remember them. Like "SpriteStartAnimation" and "SpriteClearAnimation" etc...
Other conventions I use:
* one-char variables i/a/x/y are only for temporary things like loops
* Globals are uppercase with leading G => GAPPVERSION
* Private functions have a leading underscore => function _internalstuff()
I found the best way to understand my stuff after months/years is to overhaul my objects/functions after completion. Commenting every variable (except locals) and function together with a short description of what the whole thing does really helps me.