udDBFields()? This is Open Mike, a series of discussion posts to throw the cat amongst the pigeons. These posts are all about you — we want to hear your opinions, ideas, and thoughts. We've spoken about prefixes before; now let's talk about the actual words you use to name your AS3 objects.
Do You Abbreviate?
Do you spell out the full words of your variables' and functions' names or do you use some sort of shorthand?
Perhaps you use a mixture: shorthand for common coding words (like num instead of number) and longhand for others.
How do You Name Booleans?
Booleans: since these are always either true or false, I like to word them in a way that can always be answered 'yes' or 'no'.
UrbanSquall's coding conventions go further and insist that Boolean names always begin with
What about you?
What do You Call Your Functions?
Functions and methods generally involve doing something, so it usually makes sense to give them names which are verbs (or verb-subject pairings).
Do you follow this as a convention, or are there any cases where you might not use a verb in your function name?
When a function requires arguments, do you try to make it clear from the name what arguments you're expecting?
pingPongBall.move(x, y) vs.
Sometimes a function requires totally different kinds of arguments, which can lead to confusion. For example, suppose we have a
gun object that fires a given
bullet at a given
target. There are a few options for what we could call this method, including:
gun.fire(bullet, target); gun.fireAt(target, bullet); gun.fireAtTarget(target, bullet); gun.fireBulletAtTarget(bullet, target);
Which is better?
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.Update me weekly
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post