Programming naming schemes are as uniform as a fashion parade. The farther from the the source of your programming hobby/career, the most personalized your scheme becomes. Mine varies with each project, but tends to follow suit with the language I’m using. ECMAScripts, as in Java- or Action-, get the lowerCaseAndSoOn approach, while C languages get the underscore treatment. The last couple months, I’ve been doing Actionscript programming almost exclusively. And the following scheme has emerged:
- A public variable or accessor (g/setter) have no prefix
- If an accessor has an associated private variable, it gets the time-honored underscore prefix
- A variable holding a DisolayObject is prefixed u as in UI
- A private variable is prefixed d as in Direct
- Variables created within methods are prefixed m
- Method parameters are prefixed p (and have been for years, actually)
This system works for me because it allows me to see variable scope and purpose at a glance. I never liked the typical three-letter prefix (obj, num, int, etc) because when you start to go that far, you eventually overlap prefixes in a large project. Is sxi the prefix for my object or sxk? Oh, that’s right, yrt. When you spend time pondering what you’re typing, you’re wasting time. Besides, the variable name should explain its function which in turn should denote its object. If you’re a good programmer.