Wednesday, March 9, 2011

Helpful tips for US based developers AKA Short date time is evil

English is a bit like html. There is a standard, but not everyone understands it, and there are a number of slightly incompatible implementations.

This is most obvious in spoken English where accents, and idioms vary wildly causing mutual incomprehension.

The last time I was in the USA, I had the following conversation in a restaurant:

Me: Can I have a coke please

Waitress: I’m sorry, what did you want?

Me: A coca cola please

Waitress: I didn’t quite get that. What did you want?

Me (using the British technique of speaking slowly and loudly so the natives understand): A COCA COLA PLEASE

Waitress (getting quite testy): What?

Me: Can I have a Pepsi?

Waitress: I’m sorry, we don’t have Pepsi. Would you like a coke?


English as she is wrote.

The problem with the World Wide Web is the worldwide part of it. Whatever you write, will probably be read by people from a different country. Even if your audience is English speaking, there are enough differences between countries for confusion and irritation to creep in.

A few examples:

  • Last year, Steam had a pre release offer for a game due to be released on 10/12/10(or similar). When is that? My natural reading was Dec 10, but it may have been Oct 12. There was no way of telling without trying to divine the writer’s intentions and country of residence.
  • Last month, I evaluated several rss readers for Win Phone 7. The first one I looked at had the dates hardcoded as mm/dd. If the author had just used the standard system formatting, it would have been correct and less work.
  • I also looked at The Weather Channel for Win Phone 7. There was a setting to use metric units. However even with this selected some (but not all) temperatures were shown in Fahrenheit. As an added bonus, the tile would sometimes show a temperature of -18. Hawkes Bay hasn't seen -18 since the last ice age.
  • In Blogger post options, the Post date is in m/d/yy format


So what do (mostly)US websites and applications frequently get wrong?

Dates

Short date time is evil! Repeat that and make it a mantra.

Most of the countries I have visited use dd/mm/yy. The USA uses mm/dd/yy. I believe some countries use yy/mm/dd, but don't quote me on that.

The upshot is that a date such as 09/10/11 is entirely ambiguous without context. Even if the date has some hints, such as 09/17/11, I still have to stop and parse the date rather than reading it. When reading, I devote less than a 1/10 of a second per word. Having to stop, figure out the date, and then start up again seriously screws up my reading.

It's even worse when entering dates, now I have even more opportunity for screwing up. Fortunately most sites have moved to date time pickers or separate day/month/year boxes. Not all have though, one site I was on today used a single edit box with a helpful "dd/mm/yyyy" label beside it.

Blogs and articles frequently refer to seasons. I.e. the new gadget is due in Summer 2011.
This is still problematic; our seasons are about 5.5 months out from the USA so that requires a certain amount of adjustment.

As for the holiday season, WTF? I had to ask an American friend for clarification.

"in general US holiday season means from Thanksgiving (3rd Thursday in November) to the day after new year’s day".

That's not what I would have guessed. If we had a holiday season here, it would start just before Christmas and extend till late Jan. No-one would release anything then, we are all on holiday.

Measurement units
When it comes to measures, there is the US still soldiering on with the Imperial system, and pretty much everyone else is on metric. Unfortunately many sites and applications use just the Imperial measures which is at best an aggravation and at worst requires a quick unit conversion with Google, or more likely, a move onto a different site/app.

Now I understand feet and inches in small quantities provided I don't need to be accurate. Miles require a mental conversion so it has to be something important before I will bother with the maths. After that, I get lost quite quickly.

Ounces are awkward. To my uncertain knowledge, the only people around here who still use ounces are those engaged in buying and selling small amounts of dope. This is not at all useful in performing conversions. Update: I have been reliably informed that the local drug dealers have moved on and now sell in metric units and/or dollar units (e.g. a $250 bag). Pounds are the same as ounces, only more so.

Don't get me started on fluid ounces. I have absolutely no idea how big a fluid ounce is, and no desire to know. This has caused me some aggravation in the past; "How big a drink should I have? Well 60 oz sounds small..."

Number formats
Most countries use "," as the thousand separator and "." as the decimal separator. A few however have it the other way round. Some use spaces for a separator, and the Romans don't even use Arabic numerals.

What to do?
  1. Don't hard code date formats. I use 'dd mmm yyyy' in written text. In my web applications, I mostly use 'dd mmm yyyy'. When I use the system short date time then I make sure that I also use asp.net globalisation settings.
  2. Don't hard code number formats either.
  3. Test with multiple cultures. I generally test with NZ and US cultures for dates. I also use Norway or Sweden for testing number formatting.

Why am I picking on the Americans?
American based programmers seem to the be worst offenders. There are 2 main reasons for this:
  1. The USA is a large part of the English speaking market, too large to be ignored for developers outside it. Anyone wanting to sell software into there needs to take account of the US language and units. The reverse is not necessarily true.
  2. Observational bias. If someone was to hardcode metric and dd/mm/yyyy in their applications, I would never notice.
Update
I didn't put my location in the original post; my point is that you should write and program so that others can understand regardless of your, and their, location. Nonetheless, for those that are interested, I live and work in Hawkes Bay, New Zealand.

21 comments:

Jolyon Smith said...

Good post.

And it's worse than that Jim... the US uses their own peculiar variation of "Imperial" in some cases.

A "proper" [:)] Gallon (4.55L) isn't the same as a US Gallon (3.79L), a difference which is then further reflected in Pints (20 fl. oz) vs US Pints (16 fl. oz).

For me personally, metric measures may be convenient computationally, but I have yet to find anyone who when asked to do so can hold their fingers XX cm apart to within +/- even so much as 10%.

Ask someone familiar with imperial to hold their fingers XX inches apart tho, and you get *much* better (more accurate) results.

OK, not exactly a critical life skill, but I think this reflects that the imperial system being based on "natural" units, rather than sub-divisions of some arbitrarily chosen and largely abstract and unknowable/unvisualisable scientific constant.


Pop quiz: Hold up your fingers a distance apart equivalent to 1 half the distance that is 1/10 millionth of the distance from the equator to the North Pole (or, if it makes it easier for you, the distance travelled by light in a vacuum in 1/299,792,458th of a sec)


Good luck with that. ;)


Ironically, I myself can estimate metric distances quite accurately - by first converting them to Imperial.

:)

(and that's speaking as someone who was only ever formally taught *metric*, but grew up with both as my parents were from the Imperial generation)

Anonymous said...

LOL!! Being an Indian in America, (I mean the real Indian from India!) I know how many times a day I scratch my head with a big WTF!? feeling in my head!

A simple ON/OFF position of an electric switch baffles me even today, after having lived here for more than a decade!

Thanks,
Satya

ArkAngles said...

Preach it, Sean.

wiert said...

Then there is the use of quarters for product launches relative to fiscal years that start somewhere on an obscure date like september 13th.

Speaking of 13, and zero: USA people often can't get to floor 14 abroad, where ground floor is level zero, and they do have a 13th floor.

To make dates even easier, there is are differences in what day of the week a week starts, and how week numbers are determined.

For all of those, there is a nice ISO-8601 standard, and there are nice localization libraries that - when used properly - are painless when introduced at the beginning of a new project (and a pain when you want to introduce them as an afterthought).

Then there is this nice encoding thing, which almost everyone seems to get wrong (even over here in The Netherlands).

I tried to get myself an organ donor form, which they couldn't send me because my streetname (Pyreneeën) turned into so much garbage that the PDF generation failed.

--jeroen

Anonymous said...

People born in "metric" countries have no issue to visualize metric units. When first I encountered the "inch" I wondered if it was the width or the length of an inch... and inch size depends a lot on age and sex. After all they are as much "artificially" defined as the metric ones - people just find more natural the units they grew with. That's why important to show them data in the proper culture, whitout implying anything.

Mason Wheeler said...

Jolyon has it right. Metric units were created by scientists to take scientific measurements, and they work really well for that. But the units aren't generally as convenient for the real life interactions we're used to as the Imperial measurements, which were created by ordinaruy people to measure real-life situations.

batman said...

Mason,
I challenge you:
give us a single example where "imperial measurements" are more practical in nowaday world!

TDelphiHobbyist said...

the Canadian Gov used YY/MM/DD [may still] as a standard for a long time. Based on the link below though it would seem Canada uses every permeation ... sad. We generally can't make up our minds on Imperial/Metric measurement either and it's quite common to hear "Gosh another 15cm of snow ... we're going to have 3 feet by the end of the day."

Date format by country

Anonymous said...

@Wheeler: you're used to Imperial units - in countries where the metric ones have been in use for a very long time (and which probably never use Imperial ones before but their own because they were not under the British rule...) they have really no meaning. If you tell me you're 5' 11" I have to translate it into centimetres because it doesn't tell me anything really - but I could think you're a monster with five feet and eleven inches :-D
We may not like whatever is "alien", but what is alien for you could be the "usual" thing for someone else. Forcing your customs on someone else is never a good idea.

Mason Wheeler said...

@Batman: That's easy. Temperature. Mr. Fahrenheit defined his scale based on weather conditions, and it fits pretty well. If the temperature is below 0 or over 100, you're going to have some real trouble tolerating it for extended periods.

Mr. Celsius based his scale on the freezing and boiling points of water. Water is very useful in all sorts of scientific experiments, but you're most likely never going to experience an ambient temperature of 100 C in your life.

Plus, since the Imperial degrees are spaced closer together than the Metric ones, you can get a much more precise value without having to use fractions.

Sean said...

@Mason
Seriously? I am unlikely to see either 0f or 100f without either travel or industrial equipment. Living in a primarily argicultual area, freezing is a far more important temperature than those.

If you had said yards or inches (but not both), I would have given you a point.

Anonymous said...

@Mason - Rubbish. It's whatever you learn and get used to that makes the most sense to an individual.
Fahrenheit is almost meaningless to me.

Whether or not you like the metric system, being able to easily convert between units based solely on multiples of 10 is far superior to anything else ever created.

How many stone are you and what's that in ounces?

Jolyon Smith said...

@Everyone who said "it's what you're used to" that determines ability to visualise measurements ...

This is a fallacy that I specifically tried to get across in my original comment.

I am repeatedly challenged when I make the assertion that metric units are harder to visualise/estimate, and I am told it's just because I "grew up with Imperial".

I then ask that person (someone who invariably grew up with the "superior" metric system) to hold their fingers 5, 10 or 15 cm apart.

It is always a source of amusement for me and frustration and embarassment for them when they fail, miserably.


Yes, the divisions of 10 make MANIPULATING the NUMBERs much easier - which is why metric is much more convenient for computation, especially for computerS.

But for CENTURIES, cultures around the world independently devised units of measure that were NOT comprised of constituents that were divisible by 10, DESPITE having (in the main) base 10 number systems, and readily available counting devices (our fingers) also 10 in number.

Why might that be?

Was humanity universally stupid?

The "Imperial" system is only one such example of these systems, one that gained worldwide recognition thanks to the eponymous empire that used it having, at one time, such a far reach across the globe.


Nobody said that Imperial was "more practical" in the modern world, but that doesn't mean that the alternative deserve the derision and mockery they often receive.

FWIW - since I grew up with and was taught metric, I never did get my head around lbs, stones and ozs.

But I can still better guesstimate XX inches, feet or yards than I (or most other metric babies in my experience) can estimate XX mm, cm or metres.

As I said, empirically (sic - LOL) I and most people I know who are familiar with imperial, are better at estimating distances than those who know only metric. Even at guesstimating metric distances themselves (as I said, by first converting to Imperial before visualising).


There are exceptions of course, some people are good at estimating metric distances. My only point is that this is a much rarer skill in the "metric community", and the reasons are quite obvious from the origins of the different measurement systems.

Anonymous said...

It looks many are still failing to see what this post said. It was not about what system is better, is how ambiguity of some formats and forcing your system on others who are not familiar with it leads to less appealing applications.
What is "better" is what the user expects, not what you think is.

Anonymous said...

Good post, and I agree with most of what you say, but you've fallen into your own trap: "Whatever you write, will probably be read by people from a different country". Since I'm in the U.K., and I just found this post via a link from elsewhere, I assumed you are in Britain too, until I got to "... our seasons are about 5.5 months out from the USA ..." which brought me up short. Obviously you are in the Southern Hemisphere, but where? A short hunt about on the site answered that question, but in an article such as this, it should be stated explicitly.

Anonymous said...

@Jolyon Smith:
An inch is a much larger unit (1 inch = 2.54cm), so a 10% difference is much larger.

@Mason
I think the only reason why you prefer Fahrenheit, is that you are used to it. I have no problems with weather.

-30 You really don't want to be outside more than necessary

-20 It's uncomfortable if you are outside for long periods

-15 I'll take the bus instead of walking

-10 I need a warmer jacket

0C is freezing point. This means that the roads will be extra slippery and a larger chance of snow

10C Time for the summer jacket

15C Unless it's windy I could be outside without a jacket

20C if the sun is shining, I could go outside in a t-shirt

22C a comfortable indoor temperature

25C warm and nice

30C too warm (but who can complain, the summer is short)

Lars Fosdal said...

Also - don't forget the date and time separators, 24h vs am/pm, the different uses of period and comma in number formats, prefix or postfix of currency symbols,

Internationalization is a royal pain.

As for metric/imperial - I remember a poster from american MAD Magazine when I grew up.

It said:
"Ban the metrics! We don't want no foreign rulers!"

François said...

@Mason and @Jolyon, I've been living in the US for 8+ years now and I still don't get the intuitive feeling for measurements in imperial units (how strange to associate imperial with the US, but that would be another debate). The only units I get a good approximation for are the US Quart as a "small" liter (minus 5%) or the pound and the yard as respectively a light 1/2 kilogram and a short meter (minus 10% for both). As for the temperature, I still don't know what to expect going out in a temperature outside of the 65F-75F range, while any temp in Celsius (even extreme ones) would "speak to me". Oh, and I have a very good grasp of what 20cm represent because it's the extend of my hand, so much more precise that figuring the size of my thumb (not 2.54cm BTW).
And to get back to the subject of this post, there are unambigous international standards, let's just use them by default, esp. for data exchange, and just present data with whatever local format the user (not the app) chooses.

mart said...

@Jolyon Smith
I could easily show you 5cm or 10cm or 15cm with my fingers...

I don't really care about if it's inches or centimeters, you can always convert them.

The date format is ambigious and that's the problem. Is date "10.11.12" tenth november 2012? or is it 11 october 2012? or is it 12 november 2010? it may even be 11 december 2010!

The similar problem (that many people don't know) is with short scale vs. long scale.
http://en.wikipedia.org/wiki/Long_and_short_scales

Mason Wheeler said...

@Sean: Really? What kind of agricultural community are you from with such mild weather? The widest climactic variations I've ever experienced come from living in the middle of farm country out in Illinois. We'd regularly go below 0 in the winter and over 100 in the summer, and in my experience most farming areas get at least oneor the other more years than not.

Sean said...

@Mason. I live in Hawkes Bay, New Zealand (http://www.hawkesbaynz.com/). We will get a frost serveral times each winter, and a few days above 30c each summer but that is as bad as it gets.

I have been in 0F, when working on a Japanese ski field and when working in a industrial blast freezer (-40 (F or C)). I have also seen 100F, in California. Neither are something I want to see regularly :).