18

One of the things I run into often is problems caused by programs which don't conform to ISO standardss.

One example would be not using the ISO country tables but making up their own shorthands, which goes okay for the United States (US), or the Netherlands (NL) but goes spectacularly wrong for the United Kingdom (GB, not UK) or Spain (ES, not SP) and a lot of other countries.

As another example, internal date notations. Why would anyone store a date as 01/02/2014 ever? It is completely unclear whether that is 1st February or January 2nd, whereas if you use the ISO standard you just store 2014-02-01* and it's unambiguously February 1st.

My question: When and why should a programmer make up their own constructs when there is an ISO standard available?

* Store 2014-02-01, and format the date accordingly when showing it to an end user.

Aaronaught
  • 44,005
  • 10
  • 92
  • 126
Pieter B
  • 12,867
  • 1
  • 40
  • 65
  • 64
    Because they don't know them, or forgot about them! There are gazillions of ISO standards.... Do you know all of ISO26262? – Basile Starynkevitch Jul 25 '14 at 09:21
  • 11
    Usually a lack of experience as a programmer makes you do things of which you don't realise what the consequences are. Generally a quick "I'll just do it like this" is thought of instantly without any evaluation on whether there's already something existing for it or not. – dammkewl Jul 25 '14 at 09:21
  • 13
    Also, many ISO standards are not that easy to find (usually they cost big bucks, and finding the latest draft is not that easy!). – Basile Starynkevitch Jul 25 '14 at 09:24
  • 1
    In the case of experienced programmers/database designers, it's usually a big ego that prevents them to use the standards. They don't trust ISO or any other standard bodies because they consider the ISO code is "not stable enough", meaning it will change. So they create their own, made-here or auto incremented codes/identifies which hinder interoperability. See this question: http://programmers.stackexchange.com/questions/204340/do-these-specific-tables-need-surrogate-keys – Tulains Córdova Jul 25 '14 at 09:30
  • 3
    Ignorance. Habit. Laziness. Not-invented-here syndrome. Compliance with other, contradicting standards. Misguided requirements. The list is endless (although most of these are 'would', not 'should'). – Kilian Foth Jul 25 '14 at 09:33
  • 64
    The great thing about standards is that there are so many to choose from! – Jörg W Mittag Jul 25 '14 at 11:27
  • 1
    What goes spectacularly wrong when you use GB versus UK? When an application systematically uses one format no problems will arise? – Jeff Jul 25 '14 at 12:12
  • 2
    @Jeff because some people re-inventing the wheel make incredibly bad choices: like using the country calling code as a unique identifier for a country: some codes belong to more then one country and some countries have more then one code. – Pieter B Jul 25 '14 at 12:38
  • 2
    I can see the ones you mention going wrong too. I'm sure someone out there has stored HL for The Netherlands. – TRiG Jul 25 '14 at 13:01
  • 3
    Fortunately, no one works in [Canada](http://en.wikipedia.org/wiki/Date_format_by_country) where dates may be formatted as YMD (government), DMY (French speaking) and MDY (English speaking). I really feel sorry for people trying to do localization there. –  Jul 25 '14 at 13:28
  • 5
    Among the weirdest things are programs that force a non-english on a non-english locale user to change his local *system-wide* settings to decimal points in order to work correctly. Not to speak of programs that refuse to work or simply produce garbage under non-english charsets (russian, japanese, greek), let alone RTL systems (hebrew, arabic). There's some ignorance involved, I guess. – JensG Jul 25 '14 at 13:28
  • 1
    There are some issues with ISO as well; for instance, the label "Taiwan, Province of China" is frankly insulting to the users who it's supposedly intended for. I've ever read some users suggest they will not use any Web site which lists Taiwan that way. – Casey Jul 25 '14 at 14:48
  • 3
    xkcd sums it up pretty well http://xkcd.com/927/ – exussum Jul 25 '14 at 15:05
  • 1
    You shouldn't store a date as string, use DATE data type instead. – Alfredo Osorio Jul 25 '14 at 15:38
  • 2
    Wait, why 20140201 and not 1391212800? Aw darn, which is standard. – djechlin Jul 25 '14 at 15:38
  • I'll post an answer as soon as I finish rewriting my database to use ISO dates for its internal date format. – psr Jul 25 '14 at 15:40
  • 3
    @JensG: The decimal-point issue results from Microsoft's decision to have many methods default to rendering numbers in "human-readable" rather than machine-readable form. Information which is intended to be machine-parsed should be rendered using the invariant culture, and it's entirely logical for programmers to believe that code whose output shouldn't be affected by culture settings shouldn't need to say anything about them. The fact that .NET requires programmers to explicitly specify invariant culture to avoid having culture settings mess up machine-parseable data doesn't mean it should. – supercat Jul 25 '14 at 15:46
  • 1
    Someone wrote a program once . . . and didn't use ISO standards . . . and the world *still* kept on spinning . . . – Unknown Coder Jul 25 '14 at 16:37
  • @BasileStarynkevitch: FYI, many IT-related ISO standards are available at the ISO ITTF site: http://standards.iso.org/ittf/ – ninjalj Jul 25 '14 at 17:31
  • @djechlin That also specifies a time (which you may not want) and loses time zone (which you might want). There's multiple standards for a reason... – Izkata Jul 25 '14 at 18:48
  • 2
    Did I mention the CR/LF mess that we still have to deal with today in 2014? Every time I am faced with this, I want to cry. – JensG Jul 25 '14 at 19:37
  • Are IOS standards always desirable? Most people are unfamiliar with MiB (mebibyte) meaning 2^20 bytes. – Buge Jul 25 '14 at 20:33
  • I don't think it was helping matters that the OP actually quoted the ISO standard incorrectly. A number like '20140201' **is** ambiguous, but the ISO standard calls for more formatting, i.e. `yyyy-MM-dd`. Yes, it technically accepts the `yyyyMMdd` format, but we're talking about standards here and almost nobody uses the "basic" version. – Aaronaught Jul 25 '14 at 22:43
  • The United Kingdom and Great Britain are two different things. The United Kingdom is a country, which also has `uk` for its top level domain. Great Britain is an island. One that [may quite soon be split between two independent countries](http://en.wikipedia.org/wiki/Scottish_independence_referendum,_2014). Some standards are just stupid and/or impractical. – back2dos Jul 25 '14 at 23:14
  • Standards are supposed to codify existing best practice, but they often “innovate” in a way that subsequently turns out to be either a really lousy idea or way too complex to implement properly. This isn't a problem with simple code list standards (like ISO-3166), but it has often been the case historically with language, data format, and API standards. – Emmet Jul 25 '14 at 23:55
  • 2
    For `ES = Spain`, the word for Spain is España in Español. Much like Germany (ISO = 'DE') is Deutschland. – Elliott Frisch Jul 26 '14 at 06:38
  • Mostly because they don't need to use the standards. – user253751 Jul 26 '14 at 08:35
  • 2
    I can't help wondering what ISO standards, if any, govern the phrasing of questions like this one... – Walter Mitty Jul 26 '14 at 12:45
  • 01/02/2014 isn't an example of a programmer "going his own way". It's the accepted cultural convention in the U.S., and so is perceived as a standard there. It just happens to differ from the conventions of other cultures. ISO (8601 in this case) is a "good thing" because it can be used successfully in applications/systems which have broader reach than one country or culture. – Zenilogix Jul 26 '14 at 15:28
  • @JensG: If I were around when ASCII was invented, I would have specified that a teletype should home the cursor on receipt of character 000000x1, and advanced the paper on receipt of character 0000001x. Character code 00000011 would satisfy both properties, though the character following a "home-cursor" character would be required to be a non-printing character in any event, Both CR and LF are useful in isolation, and while there wasn't initially much disadvantage to requiring two characters be sent (overprinting a line would require sending a CR followed by a null, followed by... – supercat Sep 14 '15 at 22:58
  • ...the contents to be overprinted) having a combined character would have made it easier to send other control code (like BEL) after a CR-LF code without impeding transmission speed, and would also have also improved transmission speed in the event that a file was being received to tape for use on a system which could add the necessary delays when reading the tape. – supercat Sep 14 '15 at 23:01

13 Answers13

63

Never attribute to malice that which is adequately explained by stupidity. -- Robert J Hanlon.

That, and a lack of communication.

So, it's not a conspiracy of anti-ISO sentiment making people think "I know, I'll use UK instead of GB", nor is it an inclination that "they know better", or even a sense that the standard is no good. It'll be entirely because they just don't know it is there, and they should use it.

I mean, for some people, if it's not bundled into Visual Studio, it might as well not exist. For some others, maybe they just don't want the full set or it's too difficult to fetch the definitive list, so they just make up their own sub-set to solve their immediate situation. For others, the default is what gets used - so date formatting isn't "formatted in ISO, or even country locale", it's "formatted in whatever comes out" and if that suits them, then it's job done (this is usually a criticism of American programmers).

Peter Mortensen
  • 1,050
  • 2
  • 12
  • 14
gbjbaanb
  • 48,354
  • 6
  • 102
  • 172
  • 20
    It doesn't help that a lot of ISO standards are expensive and/or hard to obtain... Even if you badly want to! – heltonbiker Jul 25 '14 at 18:11
  • yyyy-mm-dd ... is not expensive – halfbit Jul 26 '14 at 09:05
  • 12
    @halfbit: Expensive to purchase, not expensive in computational resources. Seriously, [browse their store](http://www.iso.org/iso/store.htm). You want the [floating-point standard](http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=57469)? That'll be 178 francs. – user2357112 Jul 26 '14 at 09:56
32

When I program in Ruby, I generally always ignore the ISO Ruby standard. Why? Because it's incredibly restrictive! ISO Ruby is a minimal subset of the intersection of Ruby 1.8 and Ruby 1.9. The current version of Ruby, which is supported by all Ruby implementations (or at least will be very soon) is Ruby 2.1, and it has many features that make programming easier. Programming in ISO Ruby is a PITA.

When I program in C#, I also ignore ISO C#, which is a subset of C# 2.0 (and more importantly, the ISO Class Library is an extremely small subset of the .NET BCL), and instead I program in C# 5.0 and I don't restrict myself to use only the libraries which are specified in the ISO CLI, instead I use the common subset of libraries available in .NET 4.5.2 and Mono 3.4.0.

And when doing web design, I very much prefer to use HTML5 over ISO HTML (which is a small subset of HTML 4.01 Strict), again, because HTML5 is much more feature-rich than a restricted subset of an ancient version of HTML.

So, there are good reasons for ignoring ISO standards.

Jörg W Mittag
  • 101,921
  • 24
  • 218
  • 318
  • 9
    It depends, with C, C++, Fortran... the situation is very different. – Vladimir F Героям слава Jul 25 '14 at 13:31
  • 1
    This seem less like "ignoring" as the question intends, and more like "choosing a tool that does what you need". If you need C# 5.0 features, it makes no more sense to use ISO C# than it would to use ISO C, or ISO Fortran; that's simply not the tool you asked for, and ISO doesn't have an equivalent. Your example also still involves sticking to well-defined standards, just not ISO ones. – Alex Celeste Jul 25 '14 at 13:48
  • 3
    @Leushenko I disagree; the OP seems to think you should always follow ISO standards, period. +1 for a brazen counterexample to this "should". – djechlin Jul 25 '14 at 15:33
  • 3
    All well and good, but I think the question was really talking about ISO standards for data representation, not ISO standards for programming languages. – Aaronaught Jul 25 '14 at 16:39
  • 4
    Some argue that (some) ISO Standards are a perfect example of the "Design by Committee" anti-pattern... – heltonbiker Jul 25 '14 at 18:15
  • People should worry about ISO only if they are writing a compiler. And most people does not need to worry about that. But that said even [C++-11 - Microsoft](http://msdn.microsoft.com/en-us/library/hh567368.aspx) doesn't do it fully. But for [GCC](https://gcc.gnu.org/gcc-4.8/cxx0x_status.html) I think they are really trying hard. – bhathiya-perera Jul 25 '14 at 21:42
22

Per your example, "GB" is the country code for the United Kingdom. However, "UK" was the at one time the MARC (US Library of Congress) standard code, although I believe that's deprecated. And the IANA uses .uk for the top-level domain for the United Kingdom.

So, if something doesn't conform to an ISO standard, it doesn't mean that no standard is being used; it may simply mean that a different standard is being used. (As @Jörg noted in a comment, the nice thing about standards is that there are so many to choose from.) In which case the question really becomes which standard would be most appropriate for the given problem domain, environment, etc.?

Responses to that question would probably be largely opinion-based and quickly degenerate into a "religious" debate. But ISO standard conformance isn't necessarily always the best answer. For example, if a piece of software needs to interface with library databases, MARC standards might be a more appropriate choice than ISO. If most of your organization's software does things a certain way, you might want to stick with that approach, at least in the short-term -- it's your organization's "standard", after all.


Also, standards do evolve/change. What was conformant yesterday may not be today.


And, while I wouldn't want to rule out ignorance and/or sloth as the cause of the issues you point out ... the developer might simply not have had enough time to address them.

David
  • 450
  • 3
  • 6
15

Compliance with an ISO standard is not always a cost-free activity. If a particular standard isn't already implemented in the toolkit she's using, a programmer is faced with a necessary choice: Is it cheaper to properly implement this now, or not implement the standard and deal with conversions later?

It's easy to say "hey, you should always implement the standard", but everything has a cost. And there are some good reasons why a programmer may not want to implement an ISO standard.

  • The customer may be following a proprietary or non-ISO standard. Better to hew to the standard a customer is expecting than leave unintended headaches for your successor by hiding an additional implementation besides what the customer wants and your language requires.
  • There may be a great deal of existing data, and a conversion or format-break may not yet be feasible. If you have twenty years of customer contacts and contracts keyed with local date-times, you don't necessarily want to change all those hundreds of millions of fields to ISO standard dates until you can do it right.
  • Adherence to the standard may impose a greater cost than the benefit provides. If you're dealing with entries entirely within the United States, for example, the five-character ISO-3166-2 code (US-NY) is three unneeded characters over the standard US postal code (NY).
Nathan Tuggy
  • 345
  • 1
  • 6
  • 14
DougM
  • 6,361
  • 1
  • 17
  • 34
  • 1
    Agile processes aside, it's always cheaper to include any feature - including an ISO standard - during the design/specification phase than it is during the implementation/maintenance phase, because the design phase only represents 10% of the work. This is just an inversion of the law of diminishing returns - similar to how identifying and fixing a defect in production can cost up to 10x more than if it was found as a result of unit test or acceptance test. If you have a solid reason for not using the ISO standard *at all*, that's fine; if you say you'll implement it later, you're lying. – Aaronaught Jul 25 '14 at 22:40
  • @Aaronaught: Do you think I should clarify that by "conversion" I meant an external file conversion, rather than an internal re-write? – DougM Jul 26 '14 at 15:13
  • If that's what you meant, then certainly I would clarify. It's normally not that simple, as ISO defines more standards for data types than file types, and many if not most developers deal with applications that don't deal with documents or "files" per se. If, for example, you store a non-ISO date or country code in a database (and *don't* store the corresponding ISO date or country code), then the cost of conversion down the road is going to be very high. On the other hand, if you're simply talking about importing some industry-specific file type, then sure, you can do that whenever. – Aaronaught Jul 26 '14 at 15:48
  • +1 "... you don't necessarily want to change all those hundreds of millions of fields ... until you can do it right." Exactly. – David Jul 28 '14 at 12:17
14

In the case of inexperienced programmers/database designers, it's because of not knowing. They tend to reinvent the wheel because they don't know a group of people spanning industries, already discussed the issue and came up with an standard approved by all who participated, often after very long discussions, revisions, etc. Recently a co-worker of mine showed incredulity when I told him there was an ISO standard regarding whether a given week is considered the last week of a year or the first one of the next year (ISO 8601). He didn't believe a standard existed regarding something so specific. I told him that the correctness of many applications depended on that standard.

In the case of experienced programmers/database designers, it's disregard caused by "knowing better", not-invented-here syndrome, and/or grandiosity. They don't trust ISO or any other standard bodies because they consider the ISO code is "not stable enough", meaning it will change someday. So they create their own, invented-here or auto incremented codes/identifiers hindering interoperability, which they also disregard. See this similar question, albeight database-design inclined. They give reasons like:

I may not necessarily want my database design to depend on a bunch of third parties (IATA, ISO), regardless of how stable their standards are. Or, I may not want to depend on a particular standard at all.

enter image description here

Oddly enough those who disregard standards use standard USB ports, buy standard-sized DVDs and BluRays and drive cars with tires that conform to standards.

Tulains Córdova
  • 39,201
  • 12
  • 97
  • 154
  • 12
    -1 for your caricature of experienced, anti-ISO programmers. – djechlin Jul 25 '14 at 15:39
  • 4
    @djechlin The phrases in quotes are literal ones from real answers in the question linked. You can even search in the page to see those are real opinions. Also not all experienced programmers hate standards. – Tulains Córdova Jul 25 '14 at 15:55
  • Questions linked where? – djechlin Jul 25 '14 at 15:59
  • 2
    @djechlin In my answer there's a linked question, look for "see this similar question". The word "question" has a link. There you can search for the exact phrases in quotes. – Tulains Córdova Jul 25 '14 at 16:01
  • I can't see "similar question," only displays to OP if only one (or <= 4) duplicate vote. – djechlin Jul 25 '14 at 16:02
  • 2
    @djechlin the link is in the answer, not the question, here you have it: http://programmers.stackexchange.com/questions/204340/do-these-specific-tables-need-surrogate-keys – Tulains Córdova Jul 25 '14 at 16:04
  • 2
    Right, decoupling is good. Downvote stands for the thick layer of caricature added on a reasonable opinion. – djechlin Jul 25 '14 at 16:11
  • 1
    @djechlin: It *may* be a reasonable opinion, but not without more support. Simply saying "I don't want my design to depend on the ISO" is ridiculous without a well-formed "because" clause at the end of that sentence. – Aaronaught Jul 25 '14 at 22:30
  • @Aaronaught you mean like in the original answer that that quote was sampled from? – djechlin Jul 25 '14 at 22:30
  • @Aaronaught *actually* a more accurate reading is "supposing you would want this decoupling for whatever reason..." which is why it's wrong to quote the original answer this way. – djechlin Jul 25 '14 at 22:31
  • 5
    On the flip side, the person who wrote this answer is misrepresenting the linked question; the issue there wasn't with people not wanting to *use* the standards, but with depending on the *stability* of a particular standard **as a primary key**. Most experienced database designers today will try to steer you away from "natural keys", period, because they almost inevitably turn out to be less natural than you'd originally assumed. That's simply an argument for decoupling the *physical* database design from the *logical* data - nobody said not to use the standards at all. – Aaronaught Jul 25 '14 at 22:33
  • @Aaronaught A scenario which is a _perfectly valid_ answer to the original question, despite this answer's mis-characterization of the reason as 'grandiosity' and 'mistrust' and 'not-invented-here-syndrome'. I can tell you, as the person who wrote the quoted portion of this answer, that my reasoning had nothing to do with grandiosity or mistrust. Perhaps some day user61852 will have experience enough to understand that the 'blindly-implement-standards-just-because-they-exist' strategy is not always the best strategy. Oh wait, am I mis-characterizing the spirit of this answer? Hmm. – Eric King Jul 26 '14 at 16:43
  • 1
    @EricKing: I'm not sure what your intent is with that comment; I was *defending* your answer, but the last couple of sentences of your comment are straying considerably further into NIH territory than your original answer to the database question. If a standard is really a standard (i.e. used by the majority of the industry, and not a draft or some proprietary implementation that a single party wants to ram down everyone else's throat) then the burden of proof is on you to show that you have legitimate reasons for throwing away compatibility. – Aaronaught Jul 26 '14 at 18:01
  • 1
    One could also argue that surrogate primary keys **are** in fact an industry standard, and choosing to use something like an ISO-2/IETF country code is going *against* the standard. It's not so much an issue of "blindly implementing" a standard vs. going with an alternative, but rather understanding what the standard is actually meant for and where it applies. ISO 8601, for example, is a standard for *formatting* dates, not for *storing* them; it would be an inappropriate use of the standard to use a `varchar` column and store the date as text, rather than using a date/time type. – Aaronaught Jul 26 '14 at 18:03
  • 1
    @Aaronaught I'd like to see an authoritative source documenting that "all-surrogate" standard. – Tulains Córdova Jul 26 '14 at 18:19
  • 1
    @user61852: A standard doesn't need an authoritative source to be a standard. It's *usage* that elevates a practice to a standard, and agreement between various parties on the rationale that elevates it to a *good* or *useful* standard. Relying on any "authoritative source" - including the ISO - to define every possible standard, is precisely the kind of blind adherence that Eric is talking about. At that point it's no longer pragmatism but intellectual laziness. Standards are a kind of [network effect](http://en.wikipedia.org/wiki/Network_effect); widespread usage is what makes them useful. – Aaronaught Jul 26 '14 at 18:30
  • @user61852: For example, [IP over avian carriers](http://tools.ietf.org/html/rfc2549) is legitimately defined by the IETF. Nobody's actually using it, and you'd be a fool to try. XHTML is also a standard, but you won't find many people using it anymore. – Aaronaught Jul 26 '14 at 18:36
  • @Aaronaught the first paragraph of the avian document states "It does not specify an Internet standard of any kind." But I get your point. – Tulains Córdova Jul 26 '14 at 18:40
  • @Aaronaught Sorry, I wasn't directing the last part of my comment to you, but to user61852, whom I thought was being pretty arrogant and dismissive with this answer. I should have been more explicit. I was snarkily agreeing with your comment. – Eric King Jul 26 '14 at 21:55
10

Well, people tend to ignore ISO standards: for example, you wrote

if you use the ISO standard you just store 20140201* and it's unambiguously February 1st.

but the fully ISO8601-compliant rendition is in fact 2014-02-01. (see also xkcd 1179)

Clément
  • 222
  • 1
  • 5
8

One of the reasons is that the application domain and the users might not use these standards themselves. Even when some domains use some standards, some of them might have made different choices than the ISO standards, often for historical reasons.

If your users already use "UK" in their existing procedures(1) to refer to "United Kingdom of Great Britain and Northern Ireland", it doesn't necessarily make sense to use "GB" in their data structures (especially if what you mean by country isn't quite an "ISO" country, e.g. separating UK nations or having subtle differences with the Channel Islands and so on). Of course, you could have a mapping between internal storage a presentation, but sometimes, it's a bit over the top. You're rarely programming for the sake of programming, you often have to adapt to your environment.(2)

You also have to remember that these standards have evolved in parallel with software. You often have to develop within the context of other pieces of software, some of which may be imperfectly designed, some of which may still be affected by legacy decisions.

Even if you look at internal data storage formats, some ambiguities are hard to resolve. For example, as far as I know, Excel uses a decimal number to represent timestamps: it uses an integer as the number of days since a reference date, then what's after the decimal represents the fraction of the 24 hours to give you the hour... The problem is that this prevents you from taking into account time zones or daylight saving time (23h or 25h in a day), and Excel will convert any date/time to that internal format by default. Whether you want to use the ISO format or not becomes irrelevant if another piece of software you have to work with doesn't leave you a choice.

(1) I don't mean "programming procedures" here.

(2) Don't ask me why people don't use those standards in their daily lives either. I mean YYYYmmdd is clear, dd/mm/YYYY is clear, but ordering a date with medium, small, big order of granularity like mm/dd/YYYY, that just doesn't make sense :-) .

Bruno
  • 327
  • 1
  • 5
  • 1
    Ha! You know what doesn't make sense? Commas where decimals should be! ;) – Darkwater23 Jul 25 '14 at 13:41
  • @Darkwater23 Ha, I don't mind that one either way, it's just a convention and it doesn't need to make sense. It's just that I've always found that mm/dd/YYYY seemed to lack logic altogether, why not go as far as mm-MM-dd-HH-YYYY for timestamps ;-) But hey, I agree, that's just the way it is, so we have to live with it. – Bruno Jul 25 '14 at 13:51
  • 2
    @Darkwater23 Actually, [an ISO standard uses a weird unicode symbol (this: `⎖`) for decimal separator on keyboards](http://en.wikipedia.org/wiki/Decimal_mark#Other_numeral_systems), and I thought plain tick marks (`'`) were standardized for digit grouping as well (although I can't find it now) – Izkata Jul 25 '14 at 18:57
  • +1 for pointing out another reason that daylight-saving is a wast of time. – ctrl-alt-delor Jul 26 '14 at 08:44
  • 1
    @richard I don't necessarily mind DST either way, but surely programmers should aim to store their timestamps *with* timezone information as much as possible. It's not uncommon for an application to be used across multiple time zones (independently of DST) anyway, making sure you leave as little room for ambiguity when you store a time stamp should be part of the initial design. (It might not be always applicable, but in doubt, it's always worth taking it into account.) Of course, it's a complicated problem (not just +01 hour for example, but the locality can matter too, depending on the use). – Bruno Jul 26 '14 at 13:15
  • If you're the Irish Post Office, you want to treat Northern Ireland differently to the rest of the UK: the postage rate is cheaper, and no doubt the procedure for actually delivering mail is different. Local concerns can override ISO standards. – TRiG Sep 23 '14 at 18:21
8

Why would I not use ISO 3166-1 alpha-2 country codes?

Because I use STANAG 1059 country codes... and in that UK is the code for the United Kingdom (instead of GB as per ISO 3166-1).

Alternatively I could use the FIPS country codes - again UK is the country code for the United Kingdom.

There are many standards (ISO and non-ISO) and sometimes a particular domain uses/demands a standard which is incompatible with the ISO standard.

MT0
  • 293
  • 1
  • 3
7

Storing 20140201 is not unambiguous at all. Only when you include the knowledge that is following the ISO standard does it become unambiguous. The same goes for 01/02/2014: when you include the knowledge that the format is mm/dd/yyyy it is also perfectly unambiguous.

As long as the application does not have to interface with other application any well documented standard can work just as fine.

There is a tradeoff between what is easy for humans (I tend to use 1-2-2014) and computers (who would even be better of with a binary representation instead of ISO). Novice programmers tend to stick with what they can easily understand, more experiences programmers start to see the advantages of computer-oriented storage.

Jeff
  • 219
  • 1
  • 1
  • 4
    Agreed. I would be more concerned with ISO if I was writing an application for international consumption. My apps for Middle America don't need the overhead or restrictions. – Darkwater23 Jul 25 '14 at 13:37
  • 1
    Yup. I'm in 'Murica too and I've never even had to care about localization yet. – Graham Jul 25 '14 at 13:39
  • 1
    Using the iso is not so much about localization but about standardization. – Pieter B Jul 25 '14 at 13:42
  • 4
    By writing *"As long as the application does not have to interface with other application"* you've given a strong reason to use the ISO standard. – Tulains Córdova Jul 25 '14 at 14:18
  • 5
    Your profile doesn't list your location, so I don't know whether your sample date is in January or February. – djechlin Jul 25 '14 at 15:35
  • 6
    -1 for assuming won't interface with other applications. This is contrary to the entire programming industry. – djechlin Jul 25 '14 at 15:41
  • 2
    If one knows that an eight digit string is supposed to represent a date which is sometime after the Middle Ages, how would YYYYMMDD be ambiguous? The first two digits would exclude any possibility other than DDMMYYYY, and that possibility would be excluded by the fifth and sixth digits (the only thing 20091104 could be besides November 4, 2009, would be September 20, 1104, and unless one is writing about medieval history, the latter possibility seems unlikely). – supercat Jul 25 '14 at 15:53
  • 2
    @supercat : When you only get the digits 20140201 it may also be a date encoded as YYYYDDMM. It is extremely uncommon to do so but not impossible. Only when you know the author used ISO encoding can you be sure. – Jeff Jul 25 '14 at 16:02
  • 18
    @Jeff: I have *NEVER EVER* seen a date coded as YYYYDDMM for any purpose other than to claim such a coding is possible. Have you? – supercat Jul 25 '14 at 16:30
  • 4
    -1 @Jeff Sure it is not impossible that they encoded YYYYDDMM. But does it ever happen?. Seriously, have you ever seen that? It's also possible that your 8 digits are YDMYDMYY too - should I worry about that? – user949300 Jul 25 '14 at 16:31
  • 2
    My point is that you should never assume anything about a date representation without proper context. I would never assume anything about 20140201 just because it happens to begin with 20 and looks like a date in the current century. – Jeff Jul 25 '14 at 17:27
  • 4
    @Jeff: If the eight digits are known to represent a date, YYYYMMDD is the only common format which would fit any 20th century date in that format. If some of the digits may have some meaning unrelated to the date, all bets are off. Many product expiration dates are concatenated with other information in such a fashion as to be ambiguous. Does Exp:14OCT134212 mean October 14 of 2013, and 4212 is a lot code, or October of 2014, and 134212 is a lot code, or October 14 of the year the product was made, or what? But if eight digits are known to be a date, YYYYMMDD is unmistakable. – supercat Jul 25 '14 at 22:13
  • http://xkcd.com/1179/ - no YYYYDDMM even there. Also YYYYMMDD is arguably the most popular order, because of it being used in China and neighboring countries. – Esko Luontola Jul 25 '14 at 23:13
  • To avoid all the decimal separator problems, one should ALWAYS use the following system: `7.5` or `7,5` or whatever would be `7+2⁻¹`. All your problems simply vanish. It's like magic. – Thomas Eding Jul 26 '14 at 02:26
5

In my experience programmers fail to use ISO standards for a variety of stated reasons, e.g.:

  • "I didn't know that there was an ISO standard" (ceases to be a valid reason once you're told!)
  • "The standard is inaccessible (can't find /afford a copy)" (really??)
  • "The standard is too restrictive" (usually if the standard says "don't" then there's a good reason. Ignore it at your, and your customer's, peril!)
  • "The standard doesn't include the latest functionality / library" (no standard includes EVERY library that you'll ever want to use so adhere to the standard for the things that it DOES include/cover and be consistent with the standard for the things that it doesn't)
  • "The standard is too cumbersome to implement" (greatly over-used excuse but see below)

The only reason that I accept from my staff, as not being a lame excuse, is "the standard really isn't a good 'fit'" - backed up by evidence. Sometimes the complexity of the the applicable ISO standard is out of proportion to the problem / solution. Sometimes the context in which you will implement your solution is significantly different from that assumed by the standard. And sometimes the standard can be improved upon - that is how progress happens.

More often than not though, the failure to use the ISO standard can be attributed to inexperience, laziness or arrogance. I regret to say that English-speaking programmers are particularly guilty of laziness as regards internationalisation and that our US colleagues tend to perceive ISO as "an irrelevant European thing" (apologies to the minority to whom this does not apply).

Pierre.Vriens
  • 233
  • 1
  • 2
  • 11
GI8RQI
  • 59
  • 1
  • 5
    It isn't necessarily an irrelevant European thing, it is an irrelevant unless you need to inter-operate with someone who follows them. How often do Europeans follow ANSI standards without a reason other than hey look a standard? – stonemetal Jul 25 '14 at 17:03
5

A point not raised so far is the cultural appropriateness of international standards.

Consider the international standard for measurements. Let's present those to users in the United States. I'm not sure all your US users will be happy about kilometres, kilograms, and litres.

Consider that international standards are written by governments. If the government of Spain chooses not to recognise the Basque language then how does it get a ISO specification? This is particularly an issue with the dialects and creoles of marginalised groups.

Even country codes can be problematic: does the Crimea now get its own country code? Formulas are eventually found (eg, "Former Yugoslav Republic of Macedonia") but your application may need some stand-in until the diplomacy or war comes to an end.

Consider that international standards are written with particular applications in mind. These may not entirely fit your application. For example, if you are storing language with a view to sending letters then you may wish to code the blind distinctly, even if they are proficient in speaking, say, US English. Statistics organisations are well aware of the need for specifying the exact meaning of a variable (aka the variable's "meta data") as they encounter every possible edge case during a population census. Some of that rigour is well worthwhile for database fields.

The final point is that in making these sort of choices your program may be making a political statement. This reality can mess with the nicest of code (eg, you may need multiple language names for the same language).

vk5tu
  • 151
  • 1
  • I believe most blind people would be able to get someone to read a letter to them. It's not like you'd be the first person (or company) to send them a letter. – Wildcard Jun 14 '16 at 19:00
1

ISO has lots of standards. As did CCITT/ITU. Some of these standards are "aspirational" standards, while other are minimum required functionality. It's not often clear which is which.

I remember in the 1980s asking why some equipment vendors implement one subset of the standard while other vendors implement a different subset. That's when it came out that the standards are often set before something works. And vendors often deliberately choose not to implement standards so that they can hamper interoperability, which then grants them an advantage.

That's why I like IETF RFCs. They don't even become RFCs until there are 3 independent implementations of the RFC.

Jay Godse
  • 1,174
  • 7
  • 11
  • 2
    The "rough consensus and running code" model of the IETF was well abandoned since at least as early as 1995. I was too involved in the IETF in that era and the model was "a spec that I sneezed out and not even a reference implementation". It was nice when the "running code" standard was in place instead of figuring out how to implement a wholly under-specified protocol and make it work with other implementations that had to guess as much as you did. – msw Jul 25 '14 at 18:28
  • 1
    When I started using IETF RFCs, I used the ones developed well before 1995. The running code specs are the best. Otherwise you end up with too many ivory-tower chartware engineers dreaming up specs without the responsibility of making them run. – Jay Godse Jul 26 '14 at 22:03
1

If I'm building an Oracle database, and I want to store dates, I'm going to use the Oracle DATE datatype. I won't know, or care, whether or not Oracle conforms to the ISO standard. This is really a case of my conformance to a different standard (the Oracle one) and not so much departure from the ISO standard. See @David's response.

In some cases, by the time I realized there was an ISO standard for something I had designed, the cost of going back and redesigning would have been prohibitive, or at least was seen that way.

In the short term, more working code is produced by using available standards or by inventing new ones than by careful research into extant standards. The downside occurs when large scale integration requires interoperability. This almost always occurs in the context of a later project.

Walter Mitty
  • 806
  • 5
  • 14
  • 1
    I'm not familiar with Oracle, but when using SQL Server or MySQL I too of course use their respective date datatypes when storing dates. But when writing queries with dates, they both recognize yyyymmdd very well where it's hit or miss when you use a locale date. – Pieter B Jul 26 '14 at 18:52
  • That's a good point. The standard for the storage and the standard for the interface could be different. – Walter Mitty Jul 26 '14 at 23:13