|
|
Re: enum best practices?
|
Posted: May 11, 2006 4:20 AM
|
|
I used enums like:
enum Correction{LEFT, RIGHT, CENTER};
enum Direction{ASCENDING, DESCENDING};
enum WorkSide{TOP, BOTTOM, LEFT, RIGHT, FRONT, BACK};
enum Workstep{CLEAN_AREA, FINAL_CUT, ROUGH_CUT, ...};
enum Status{OK, NO_TOOL, INVALID_COORDINATES, ...};
I just love enums. No more error handling except the check for null, readable code ...
Use enum for everything where you previously used constant Strings or ints, so no one can mess with invalid parameters.
|
|