I’m having an event-model that has a status attribute, and wonder if I should make it into a string or integer field.
The event can have three different statuses, “gathering”, “active” or “closed”.
If I should go with the integer solution, should I define a constant somewhere making it possible to just use CLOSED insted of “2” (and where should I put this constant??)
Thanks in advance!
I would recommend using an integer for two main reasons.
Weather you choose strings or integers, you should define them as constants and reference them only through their constants. You should never use the values directly.
http://en.wikipedia.org/wiki/Magic_string_(programming)