[HN Gopher] Does Your Code Pass the Turkey Test? (2008)
       ___________________________________________________________________
        
       Does Your Code Pass the Turkey Test? (2008)
        
       Author : hosteur
       Score  : 33 points
       Date   : 2024-12-06 20:18 UTC (2 hours ago)
        
 (HTM) web link (www.moserware.com)
 (TXT) w3m dump (www.moserware.com)
        
       | SideburnsOfDoom wrote:
       | As for dates and times interchange, use ISO 8601 (largest to
       | smallest order).
       | 
       | The EU and many other countries ordering of day, month, year
       | (smallest to largest order) also makes sense, but is sadly
       | ambiguous due to
       | 
       | The US format of month, day, year (middle-endian order)
       | https://9gag.com/gag/a2KEqOe
       | 
       | US not TUrkey is the outlier
        
         | nayuki wrote:
         | DMY dates don't make sense. The units are from smallest to
         | largest, but the string within each unit is still written from
         | biggest to largest.
         | 
         | Furthermore, if DMY makes sense, then you could argue that
         | SS:MM:HH or MM:HH has a valid use case. (It does not.)
         | 
         | Hence, ISO 8601 is the one true date format, assuming you still
         | believe in writing numbers in big endian.
         | 
         | If you want, you can argue for numbers being written in little
         | endian. For example, the year "two thousand twenty-four" could
         | be written as 4202, and maybe pronounced as four twenty
         | thousand-two. In that case, go ahead and write dates as
         | SS:MM:HH DD/MM/YYYY; it is UTC 61:45:12 60/21/4202.
        
           | elpocko wrote:
           | That's crazy. What's next, abbreviating "Coordinated
           | Universal Time" as _UTC_ instead of _CUT_?
        
           | SideburnsOfDoom wrote:
           | > then you could argue that MM:HH has a valid use case. (It
           | does not.)
           | 
           | "twenty past ten"
           | 
           | (It does.)
        
           | mrweasel wrote:
           | > DMY dates don't make sense.
           | 
           | This is a language issue. DMY makes perfect sense in
           | languages where you'd normally say the date in that sequence.
           | The "problem" is that English doesn't do that. The natural
           | flow in English is MDY, e.g. July 4th, 2024. That not how
           | Germanic language (at least those I know) works. In Danish or
           | German you'd say "4th July, 2024", that's just how those
           | languages work.
           | 
           | I do agree that for computing ISO 8601 is the way to go as it
           | sorts correctly.
        
             | SideburnsOfDoom wrote:
             | > The natural flow in English is MDY, e.g. July 4th, 2024.
             | 
             | I'm sure that's true. This seems more like US custom than
             | the whole English language. "July 4th" sound a bit forced
             | and not natural to me, and I am a native English speaker.
             | Not US English though.
        
             | mphalan wrote:
             | In England (and Ireland). One tends to say "The 4th of
             | July". "July 4th" is an Americanism.
        
               | HideousKojima wrote:
               | Both "the 4th of July" and "July 4th" are common in
               | American English
        
               | SideburnsOfDoom wrote:
               | Yes, and only "the 4th of July" is common in UK English.
        
       | frizlab wrote:
       | Most of these problems have incorrect solution. For instance, the
       | actual solution to parsing portrait or landscape is to not use a
       | string for this. It should never have been a string! Other better
       | solutions apply for the rest too.
        
         | 9rx wrote:
         | The command line is defined by strings. It had to be a string
         | to stay within end-user requirements. You may be able to make a
         | good case that the string input is best represented as
         | something parseable by an existing argument parser library, but
         | even then you are dependent on that library handling the
         | strings correctly. Which, at best, pushes the problem onto
         | someone else. Someone else who still has to be aware of input
         | possibilities.
        
           | frizlab wrote:
           | Oh missed the context, my bad. That being said, in that case,
           | I'm definitely not convinced by the need for toLower (:
        
           | do_not_redeem wrote:
           | Why would you accept ArBiTrArY-cased command-line arguments
           | in the first place? I don't think I've ever seen a cli
           | utility that accepts the wrong case. Just compare the raw
           | bytes. `ls --ALL` doesn't work, and neither should `my_app
           | --PORTRAIT` (no matter which "I" you type).
        
         | chrismcb wrote:
         | You are pausing a command line parameter. It will always come
         | in as a string.
        
       | kobalsky wrote:
       | This is from 2008
        
       | saaaaaam wrote:
       | Of course, the Turkey test itself now fails the Turkey test as
       | Turkey has been updated to Turkiye.
        
         | nayuki wrote:
         | That was a very heavy-handed move that overrides traditions in
         | many languages
        
       | QuercusMax wrote:
       | There's one more test: the Thailand test. I've been bitten by
       | issues in Java where Calendar.getInstance() will return a Thai
       | Buddhist calendar, which is exactly the same as the Gregorian
       | calendar except 543 years in the future.
        
         | brudgers wrote:
         | Wouldn't issues in Java be failing "The Indonesian Test?"
        
       | shreddit wrote:
       | Ah yes, ye old m/d/y - d/m/y debate. One is clearly wrong but the
       | Americans won't listen...
        
         | Arch-TK wrote:
         | Both are wrong, one is wrong-er. y-m-d h:m:s all the way.
        
         | HideousKojima wrote:
         | While it's confusing and I prefer y-m-d over both of those, the
         | American way is based on the way dates are said in spoken
         | (American) English. Hence things like September 11th, 2001
        
         | hansvm wrote:
         | Found the sock puppet
        
       ___________________________________________________________________
       (page generated 2024-12-06 23:00 UTC)