What is the most appropriate way to store names in a way that is unlikely to run into issues?
What is the most appropriate way to store names in a way that is unlikely to run into issues?
Did I just win database?
And you can't extract any piece of the "envelope" name to give you the "hello" name: For a person named John Smith, in some cultures it's normal to say "hello John", in others it's "hello Mr. Smith", in still others it's "hello Smith".
And of course, the full name could be "John Smith" or "Smith John" depending on culture. And then there are cultures that have more than one "word" to a name, but there is no family name.
I wonder how many fields would be the end result. I have no idea.
They should stop with the BS and just state my name:
Fred Example,
Congratulations! You have won a lifetime supply of...
To answer your question: I dont know if theres a good single spec to follow.
First, Legal Name, as required to appear on legal forms in their area. (And oftentimes if they don't fill this in correctly it'll then be on them, and not on you.)
Second, Preferred Name, so that you can throw that into greetings and whatever else you feel the need to personalise.
The whole problem of people not having middle or family names goes away when it's treated as a single field. You don't care about tokenizing the field, because you only ever reproduce that field verbatim.
If the user believes a middle name identifier isn't necessary, then it probably isn't. It's only one aspect of the identifiable information used to identify the legal entity of that person anyway. If you have a name, address, possibly CC information, and email, that's probably more than enough to claim they're a customer for whatever legal purpose the business needs.
The individual parts inside don't, and shouldn't, matter.
- First initial and last name are used for some things, such as usernames.
- First name and last initial are used for some things, such as public displays where you don't want to have the full name
- Last name is used to sort lists
- Names are entered differently due to error or constraints in different places, so you want a way to search the parts that stay the same. Sure, you can imagine everybody just had a string field, but it can't happen all at once. And on a global scale, there are definitely people who will enter their name differently anyway.
It sounds like you're just kicking the problem downstream a tiny bit, and making it slightly worse by adding another point which enforces an invalid data model.
Your last sentence is certainly true but I don't see how separate fields makes it any better (or worse).
How do you tell an initial from a single character name?
How do you sort by last name if a person has one word for their entire name?
Assuming names are spelt the same or have a fixed length is also not accurate.
It’s all a trap - using one string might be a terrible solution, but it might also be best.
You commonly see companies with user names that started as first character of first name + last name, and then you see later ones that don't follow the pattern when they realize they can't make it work.
My wife for one. At the very least make the last name field optional.
Say the user has three given names and a family name. For whatever reason, she puts double spaces surrounding the two middle names, but she didn't last time. Or jams them together, maybe with another punctuation. Are those semantically meaningful differences? Do the spaces indicate we have two separate people? Would a shortened form for one of the names be meaningful? Or if she misspells the abbreviation for "Marquise"; is that part of her name now? Etc.
If we're accepting that names can have infinitely varied forms, and that whatever the user enters right now is canonical, then questions like that become very difficult. Normalization for comparison is a real requirement in some cases, and separate name fields give us a leg up on that.
I'm not saying this is insurmountable, or that we should make it the user's problem. Just that the single field doesn't quite solve everything in one fell swoop.
---
[0]:I don't say this to blame the users -- computers overall could almost certainly do more to not leak the details of storage into the front end where users have to deal with it.
Why do you care, though?