views:

50

answers:

1

I need to create an app that fetches the choices for some of the fields from a web service. Those fields are things like Country (single value), State (single value), Interests (Ecology, Biology, Chemistry, etc.) (multiple values), etc.

The web service returns for Country looks like:

{
    'USA':'United States of America',
    'GER':'Germany, Federal Republic',
    ...snip...
}

I am wondering, in the application, when USA is selected, should I store 'USA' or "United States of America." If I store the code, I would have to query the web service for the proper name every time the page is displayed. Or, should I store the country name? Or, even both values?

At this time, I don't see a need for the code and am leaning toward storing only the country name.

Thanks for any input.

+5  A: 

This smacks of waaaay premature "optimization" of a problem that will never need to be optimized. Storage is cheap and fast, network connections are slow. Store both values and be done with it.

Peter Rowell
+1 agreed. It makes sense to store the names and codes. Plus think of the nifty icons and code that you can display for each country, Olympics scoreboard style ;)
Manoj Govindan