Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Naming enum types

Tags:

java

enums

naming

If you have a set of related words (e.g. Row & Column or On & Off), how do you find the collective word that describes those words? Specifically, how do you name an enum?

If I have "Red", "Green" and "Blue", a sensible enum name might be "Color". Values of "On" and "Off" might have a sensible enum name of "Power". But how do I name the enum that can have a value of "Row" or "Column"?


Couple of good answers to "What do you name a Row or Column enum?" - Cartesian and IndexType.

What about finding collective words in general - are there any resources out there or do you just have to be good at English / know lots of words?

like image 596
Tim Gradwell Avatar asked May 14 '09 21:05

Tim Gradwell


1 Answers

Try using a name which indicates what the enum is used for, e.g

public enum CountMethod 
{
    Row,
    Column
}
like image 153
bbmud Avatar answered Oct 04 '22 15:10

bbmud