views:

429

answers:

7

I am building a class that represents a US State or Canadian Province. What should the class be called?

Some ideas:

  • Region: Problem with this is that .Net has a RegionInfo class that uses the term Region to represent a country (and not a State or Province).
  • State: Problem with this is that it could cause confusion with Application State, or Session State, etc...
  • Province: Could work, but very Canada-centric. Just doesn't feel right.


EDIT: GeographicalRegion seems like the way to go. It could even be used as a base class for other geographical region types (ie: Country) and still make sense.

+5  A: 

GeographicalRegion would be my choice. Its pretty short and totally unambiguous, and it has no connotations with real types of area such as Province or State.

Jack Ryan
GeographicalRegion might be short but I'm not sure it's totally unambiguous. If you would see class called GeographicalRegion would you understand what it represent without looking at the code?
Alex Reitbort
Can I ask what you would mistake it for? I think it perfectly describes what it represents. And, as has been edited into the question, and as I have done in my own code, it is easily reused to represent any type of national or international division. What's not to love?
Jack Ryan
I do as lot of geocoding related stuff in my job. So anything that says geographic screams x,y or latitude,longitude to me. GeographicalRegion for me can be a class that represents geographic region as in series of points.
Alex Reitbort
+1  A: 

Definitely don't go with "State" - way too confusing, and "Territory" has .ca implications too. Wikipedia suggests "Subnational" or "SubnationalDivision" would be good.

annakata
A: 

StateOrProvince

Alex Reitbort
OrTerritoryOrCountyOrCantonOrOblastOrDistrict
annakata
"I am building a class that represents a US State or Canadian Province". Reread the question.
Alex Reitbort
Like I didn't. So you're gonna bail on Nunavut, NWT, Yukon and future expansion from the get go? Designing for *now* isn't designing at all.
annakata
Then I'll rename the class. I don't see a reason to design for the whole world when developing an app that will be used in one specific country. Remember YAGNI.
Alex Reitbort
C'est la vie - I'd rather just go with a more general term that doesn't ask for refactoring later. We'll have to agree to differ.
annakata
+1  A: 

I see no problem with State; in the context you're using it in, I don't expect any confusion with application state. Everywhere you use it, you'll also be referring to Country, StreetName, and PostCode, right? Likewise if you choose to name it Region.

I don't like Region, though, because it's rather vague. All kinds of things are regions. If someone asked me what region I lived in, I might say the Midwest. Or the Western Hemisphere. Or Ramsey County. It all depends on context.

You and those working on your project should already know the context, so use a word that makes sense there. Don't worry about whether the word has meanings in other contexts; you're not working with those.

Rob Kennedy
+1  A: 

A more generic name for State, that is applicable anywhere in the world, is CountrySubdivision, or just Subdivision.

baretta
+1  A: 

@JayArr: +1 for GeographicalRegion from me.

@Alex: Although your question implies that your application is only for North America, I would suggest that you use standard ISO 3166-2 geo-region identifiers, which will allow the data to be expanded into other world regions in the future, if required.

devstuff
+1  A: 

Google uses the term administrative_area_level_1 in their geocoder.

administrative_area_level_1 indicates a first-order civil entity below the country level. Within the United States, these administrative levels are states. Not all nations exhibit these administrative levels. administrative_area_level_2 indicates a second-order civil entity below the country level. Within the United States, these administrative levels are counties. Not all nations exhibit these administrative levels. administrative_area_level_3 indicates a third-order civil entity below the country level. This type indicates a minor civil division. Not all nations exhibit these administrative levels.

REF: http://code.google.com/apis/maps/documentation/geocoding/#Types

Brad