Home  /  Questions  /  Question

50   50
Jun 20, 2013

Business Object properties: model as Objects or Enums?

If I want to represent status types ie

1 started
2 inprogress
3 completed

I know I can use Enum's in normal code but how should i represent them in the business objects layer, as objects or as enums, I am thinking about whether to use static classes?

any advice would be appreciated.

A context example would be I have new job business object and it has a status of inprogress when retrieved.

Hope this makes sense?


72   96.1
Jul 11, 2013

My suggestion is to not use separate (static) classes or objects.  
Simply use an Enum or even better a String value String are easy to display and work equally well.

In my view, anything more than an Enum or String would be overkill.


203   96.8
Aug 09, 2013
Create an Enum that contains all the possible status types. 
Enums are easy to create, easy to use, and easy to convert to and from a string. 

Good luck.