Is it a bad habit to give variables, longer names like this:
var mainMenuButtonsActiveWhenFocused:Boolean;
Also, is it bad to keep a large number of variables where you could manage to keep less?
- Kamil Waheed
- Has been a member for 3-4 years
- Author had a File in an Envato Bundle
- Author was Featured
- Item was Featured
- Exclusive Author
- Interviewed on the Envato Notes blog
- Contributed a Tutorial to a Tuts+ Site
- Microlancer Beta Tester
I think large number of variables not bad. 
What about longer names? Is that bad?
What about longer names? Is that bad?
You should keep them succinct, but its not that big of a deal. Its probably more important for you to remember what they mean.
- Author was Featured
- Bought between 1 and 9 items
- Europe
- Exclusive Author
- Has been a member for 5-6 years
- Referred between 100 and 199 users
- Sold between 50 000 and 100 000 dollars
No, there is no performance impact (your applications won’t run slower) if you use longer variable names.
- Microlancer Beta Tester
- Author had a File in an Envato Bundle
- Author was Featured
- Bought between 50 and 99 items
- Exclusive Author
- Has been a member for 3-4 years
- Item was Featured
- Sold between 100 000 and 250 000 dollars
Less variables is a plus memory-wise 
Less variables is a plus memory-wise![]()
This is what I was expecting… 
... and I was expecting the same with the longer names which doesn’t seem to be the case!
Thanks!
- Community Superstar
- Item was Featured
- Author was Featured
- Has been a member for 5-6 years
- Won a Competition
- Sold between 50 000 and 100 000 dollars
- Bought between 10 and 49 items
- Referred between 50 and 99 users
- Europe
The long names can also be a sign that the thing can be a little better structured.
For example that variable does not need to be bigger than “itemsActiveOnFocus” if the setting is already present in the option area for the main menu.
![]()
The long names can also be a sign that the thing can be a little better structured.
For example that variable does not need to be bigger than “itemsActiveOnFocus” if the setting is already present in the option area for the main menu.
Totally agree with you!
- Exclusive Author
- Item was Featured
- Author was Featured
- Author had a File in an Envato Bundle
- Has been a member for 4-5 years
- Sold between 100 000 and 250 000 dollars
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- India
I don’t think number of variables being much sensitive on memory usage. In case if it is unavoidable to use large number of variables for temporary use, you can free up memory by deleting them after usage.
delete myVar;