views:

142

answers:

3

An anonymous type can be thought of as a "Set Once" Object type, whereas an plain old Object or Variant can be set many times. An object or variant tends to be short lived, while an anonymous type is expected to live longer, making it important to communicate intent.

What naming convention do you use to communicate intent when using anonymous types?

I've searched "Naming Convention" questions and the answer is still elusive with regard to Anonymous Types which are different from objects or variants.

Hungarian Notation is like a giant nose pimple on prom night, so probably nothing useful there.

Since an anonymous type cannot be changed once it is instantiated, shouldn't be named according to its intent?

+2  A: 

When I use anonymous types in Java Swing apps I use them in the following fashion:

private ActionListener [actionPerforming]Action = new ActionListener(){ /*Stuff Here*/};

That way it is clear what the variable is doing.

jjnguy
A: 

Well, it may seem somewhat of an oxymoron but shouldn't you use whatever naming convention means the most to you, as the developer? Whatever appeals to you, makes you most comfortable..

Personally, I used to favour Hungarian Notation but I was recently converted to the camelCase (Microsoft?) method by the elegance of it. It's a matter of personal choice, really.

GenericMeatUnit
A: 

Check out Hungarian Notation naming convention. http://en.wikipedia.org/wiki/Hungarian_notation

nSize : integer (systems) or count (application)
iSize : integer (systems) or index (application)    
bBusy : boolean
chInitial : char
cApples : count of items
dwLightYears : double word (systems)
fBusy : boolean (flag)
fpPrice: floating-point
Yada