Aldric Giacomoni wrote:
I am creating a bash.org-like. Basically: just store and retrieve quotes
that people enter. I would like the user to have the option of entering
a few fields, among which are a date a and location field.
What do you think is the best default to use for these fields? nil, or
today's date (or January 1st, year 1), or an empty string?
Depends on your use case. If you think that most of the time, the user
will want to date things today, then use that as a default. 1/1/1 is
probably not a sensible default in most cases, and an empty string
certainly wouldn't be sensible for a date field (which shouldn't contain
a string). In most cases, then, for date, I'd probably use either nil
or a reasonable date (such as today).
For location...can you use Google's currentLocation or some such to get
the client's location if possible? That would be a great default for
many applications. If not, nil is good here too.
It may be possible later to search or sort using these fields, which is
why I am asking how you would do this. I may have not searched well, but
I didn't find anything on the web about this.
Note that this is really a general UI and database design question. You
will probably come up with the best solutions if you think in those