What do you name your arrays when the name of the item is already plural?
array names makes开发者_JAVA技巧 sense.
array collisionDatas not so much.
I almost always name it as Item name + s. My goal when naming a variable is to make sure that I reduce the effort needed to read and understand source code.
So if I have an array of children for example I name it childrens. I don't care at all if the childrens is an english word or not, I'm not writing a book! So later when a see something like:
foreach (Object x in childrens) I know I'm iterating on an array of children and not on an array of child objects.
Your question heavily depends on the programming language. Objective-C has strong naming conventions that people adhere to.
Try collisionDataArray.
Personally, I'm used to Cocoa and Objective-C nowadays, and over here long variable and class names are not unusual. For me, autocomplete is good enough, and the code ends up being quite readable.
I sometimes add the type in front, like:
array arrNames
array arrColisionData
I prefer to add the "arr" in the beginning so when you get them in an ordered list, they stay together.
加载中,请稍侯......
精彩评论