25

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.

Alex Czarto
  • 3,151
  • 4
  • 28
  • 28

7 Answers7

13

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
  • 8,396
  • 4
  • 37
  • 76
  • 3
    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 Feb 16 '09 at 20:29
  • 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 Feb 16 '09 at 20:47
  • 1
    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 Feb 16 '09 at 22:05
12

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

annakata
  • 74,572
  • 17
  • 113
  • 180
7

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

baretta
  • 7,385
  • 1
  • 25
  • 25
6

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
  • 15,361
  • 6
  • 36
  • 57
4

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
  • 161,384
  • 21
  • 275
  • 467
0

StateOrProvince

Alex Reitbort
  • 13,504
  • 1
  • 40
  • 61
  • 12
    OrTerritoryOrCountyOrCantonOrOblastOrDistrict – annakata Feb 16 '09 at 16:11
  • 2
    "I am building a class that represents a US State or Canadian Province". Reread the question. – Alex Reitbort Feb 16 '09 at 16:19
  • 1
    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 Feb 16 '09 at 20:21
  • 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 Feb 16 '09 at 20:28
  • 2
    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 Feb 16 '09 at 20:48
  • 1
    I concur, Mexico=State, Canada=Province, US=State, Chile=Region. StateOrProvince has the advantage of showing that it's not country specific without the ambiguity of the accepted answer: GeographicalRegion. I don't really mind putting Chile's Regions into a property named StateOrProvince, because the intent of the property is clear to any English speaking person. Whereas if I come onto a project and find GeographicalRegion...I have no idea what the heck that is until I read through the code and see it associated with states. – Kevin Nelson Jul 16 '15 at 16:36
  • StateOrProvice is directly specified in X.500, but I think that reference is rather fundamental to this unexplained answer. – Maarten Bodewes Jul 18 '22 at 14:56
0

After some consideration, I realized that in my case the requirement was to specify a region to search, so I went with IAreaLocator. The idea is that the implemented area locators will allow specification of non-finite regions. They could be geo-fences, states, provinces, countries, etc..

N-ate
  • 6,051
  • 2
  • 40
  • 48