Ask HN: Do You Use Enum for Yes, No, Unset?
6 by whitakerch | 1 comments on Hacker News.
I've seen different arguments on this topic and thought I'd ask HN if you all have a standard for this. Say you have a form that's filled out and saved to a DB. One required field is a dropdown with Yes and No. But the field begins as blank to show that a value hasn't been selected yet, ensuring that the User pays attention to the field. Do you use a Nullable Bit (DB) and Nullable Bool (Code)? OR an Enum: Yes, No, Unset? You wouldn't use a boolean to represent states like say New, Processing, Done. But do you consider NULL a separate "state"? Thanks

Post a Comment

 
Top