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.

Recommended Answers

All 3 Replies

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!

lol..cool...thanks for your input

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.