| | |
Coding Syntax
Please support our Graphics and Multimedia advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jul 2007
Posts: 84
Reputation:
Solved Threads: 2
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.
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.
•
•
Join Date: Mar 2004
Posts: 763
Reputation:
Solved Threads: 38
Someone replied to you on
http://www.developphp.com/dev_forum/...tax%20question
In short, yes you can use prev instead of prevPic, but I say stick with prevPic since it's easier to know what the function might do. prev could mean many things. It's just better coding practice to stick with descriptive names.
http://www.developphp.com/dev_forum/...tax%20question
In short, yes you can use prev instead of prevPic, but I say stick with prevPic since it's easier to know what the function might do. prev could mean many things. It's just better coding practice to stick with descriptive names.
Last edited by Phaelax; Jul 10th, 2009 at 11:50 am.
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!
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!
Last edited by JasonHippy; Jul 14th, 2009 at 8:48 pm.
There are 10 types of people in this world.....
Those who understand binary .....
And those who don't!
Those who understand binary .....
And those who don't!
![]() |
Similar Threads
- help me about more coding in SQL code except (SELECT, INSERT, UPDATE & DELETE) (Visual Basic 4 / 5 / 6)
- HELP pls, making a Login form. (Visual Basic 4 / 5 / 6)
- Array Sorting on a User Supplied Element (Java)
- c# or vb.net - how earn more? (C#)
- int problem (C++)
- Very new Programmer needs basic help!!! (HTML and CSS)
- Simple ASP.Net Login Page (Using VB.Net) (ASP.NET)
- Reading in a file. (Java)
Other Threads in the Graphics and Multimedia Forum
- Previous Thread: PLZ HELP..!!!!!!! A jpeg image having hyperlinks on the side pointing
- Next Thread: Generate Random Number ?!?
| Thread Tools | Search this Thread |
3d 10 actionscript3 adobe adobeacrobat adobereader air ajax amazon amf apple button cart childprotection cloud dashboard dell design dojofoundation dreamweaver ebay eclipse ecommerce elasticcomputecloud embed endorsement extra family flash flash-develop flashlite flex free harddrive iamthwee ibm illustrator imflash intel interactivemap javafx javascript laptop legal map micron microsoft mobile monitoringsoftware moonlight multimedia myspace nand news novell panorama pdf pedophiles photoshop photosynth php safety sandisk security shopping silverlight solidstatedrive sproutcore ssd streaming swf table ukmap unload unwanted video vulnerability web white.space xml zend zephyr zeroday





