Hey Everyone,
I know that AS3 uses what is called "camel coding", but it seems to that sometimes the names given to variables and especially functions could be shortened even more. Is "camel coding" a mandate or can they just be one word or just the first half. TO better illustrate my question may use "prev" as a function name instead of "prevPic" as long as prev is not a reserved word (which I don';t think it is)?

Thanks in advance.

8 Years
Discussion Span
Last Post by Reliable

Sorry for adding to an already solved thread,
Generally the whoie camel case thing is just to make things more easily readable, but it's not at all mandatory as far as I'm aware.

You can make your variable names as long or short as you like (there may be an upper limit on the number of chars available for a variable name), the more descriptive they are, the easier it will be for others to understand your code.

I know in older versions of flash, having lots of variables with long names could cause a performance hit when running your final .swf, so shorter variable names were an advantage, but in AS3 I don't think it would make much difference as the AS3 engine is much faster and much more powerful!

With regard to styling code and camel case, most people start AS3 class names with capitals, and all other functions, properties and variables will be in camel case.
Some people insist on CAPITALISING the names of constant values, others insist on creating member variables with a leading underscore to differentiate between _classMembers and localVariables. Some people use camel case for classMemberVariables and functionNames and use all lowercase for local_variables, but at the end of the day it's down to you and how you find your code easier to read!

Most people tend to go with the CapitalsForClassNames and camelCaseForFunctions(), memberVariables and localVariables convention!
But as I said there's nothing stopping you from creating a class called myclass, or myClass...It might be frowned upon by others when you post your code on a forum, but flash won't complain!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.