schobes blog

What's in a Name?

Written by schobes on

The BBC recently featured an article about people's names that break databases. It reminds me of an excellent talk that I saw at YAPC::NA - 2015, by Nova Patch (patch), Hello, my name is ___. While the article from the BBC touches on many of the issues, the core of the talk by patch is how much our identities are wrapped up in our names.

Accepting a user's name on a website or application may seem simple, but is actually extremely difficult. Culturally, people can have many names. For instance, in the United States, a typical name is comprised of three parts: first, middle and last. Commonly, the middle name is shortened to a single letter (initial) or excluded entirely in displays. When lists of user's names are display, typically the last name is show shown first, followed by a comma and then the users first name followed by a middle initial ("last, first middle-initial"). In order to accomplish this behavior in your application, you would most likely create a database table 'users' with the columns first_name, middle_name, last_name. Using your programming language of choice, you can accomplish outputting a name in all the formats you need.

Now imagine your application takes off, and it starts getting used by people in other cultures. Let's look at a typical South American name. For example it is typically comprised of two given names (first names), paternal surname and maternal surname. In the application we have created we have three name fields, but our new user has four names. Where should they put them? The identifier "First Name" is confusing. First name may imply that only one name should be used. So the user puts in their first given name. What goes in the "Middle Name" field? Do they put in their second given name, or should then go back to first name and add their second given name there? Crap, did we add validation to first name that prevents spaces? Once your user decides what to do, then they make it to "Last Name" and all bets are off. At best your new potential user is annoyed with your application or at worst has closed it and using Google to find another application that does something similar.

So now's the part we wrap it up and provide you with an answer on how to solve the problem.... too bad. Like I said before, this problem isn't easily solved. Here are some suggestions to handle collecting names in your application that will help you avoid some common problems, but there isn't one solution that fits all problems.

  • When asking for a user's name, provide a single input box.
  • Don't do validation on a name!!! Nobody likes seeing that an error message saying their name is invalid.
  • If you need to present names in different formats, collect the format of the name along with the name. This one maybe confusing and deserves it's own blog post (or 7)
  • Provide the user with two name fields, one for legal and one for display. This way the user can be represented as they wish within your application even if you need to know their legal name.


No Comments Yet!