> Turns out, much how working with human names is difficult due to numerous edge cases and incorrect assumptions
I think a good interview question would be, given a list of full names, return each person’s first name. It’s a great little problem where you can show meaningful progress in less than a minute, but you could also work on it full time for decades.
If I got that question in an interview, I would write a program that asks the user what their first name is. That's the only correct solution to that problem.
The fact that it’s unsolvable is what makes it a good interview problem. Seeing someone solve a problem with a correct solution doesn’t really tell you anything about the person or their thought process.
Okay, but - "programmatically determine the users name" is one of the classic foibles of inexperienced programmers. It's not that it's a hard problem, it's an impossible problem that people shouldn't be attempting, yet somehow still do, not unlike validating an email address with regex.
> it's an impossible problem that people shouldn't be attempting, yet somehow still do
You see exactly this kind of probabilistic algorithm being used every day in huge production apps. E.g. how do you think Gmail shows something like "me .. Vince, Tim" in the left column of your email inbox?
Correctly 100% of the time, as long as all of your contacts have names that match "Firstname Lastname". Google Contacts has separate fields, which enables "Vince" but at the expense of assuming that his full name is "Vince Sato" when he may write it "Sato Vince".
The problem with probabilistic algorithms is that you trade predictability for getting it right more frequently (but not 100% of the time). Eg. I could match common Japanese family names or look for a .jp TLD, but neither of these are guarantees that the family name comes first, and even less does their absence imply that they lead with the first name.
I imagine Google's algorithm is no more sophisticated than:
1. Are they in your contacts? Use their first name from your contacts.
2. Are they a Google user with a profile you can view? Use the first name they provided.
3. Use your locale to make a wild guess.
True story: a few weeks ago, I was trying to debug my Python program, which was reading PubMed XML. It was choking on 'None' as a first name. If you know Python, you know that it uses the keyword None to represent a null element. Turns out the XML used None where an author didn't have a first name, and the Python library I was using interpreted the string "None" as None rather than the string "None", and this was causing some downstream error where another function was expecting a string. I had to write a special Python function to convert the string "None" into a string (an empty string).
I think a good interview question would be, given a list of full names, return each person’s first name. It’s a great little problem where you can show meaningful progress in less than a minute, but you could also work on it full time for decades.