Hacker News new | ask | show | jobs
by zurtri 811 days ago
In my SaaS software I made the conscious decision to record names as "full_name" (e.g. Mary Smith) which is basically your legal name and then "short_name" (e.g. Mary) which is what I would address a letter to.

This handles a whole bunch of issues with people who have just one name (which I believe is high status in some cultures) and cultures where the family name is first and then the given name.

I have had very little issues with it - even though most customers expect first_name and last_name.

I had a police officer talk to me about my software and they were mucho impressed about how this naming system handles all the different name types. They say some of their system have issues all the time with some names.

Is it a perfect system? No, but it seems to be one of the better ones.

3 comments

If you want to really do it right, so it works for everyone, this is the only way.

However, when I actually did it this way, it caused problems as soon as we partnered with another company and had to communicate with a system designed in a less-progressive manner. (I.e., about 99.5% of existing systems.) We couldn’t generate an export for that partner without first and last name fields, and we had no way to reliably generate those from the full name field.

So, ironically, if we had let the user decide how to compromise the integrity of their name up front, we would have had a better user experience than after our computer started butchering it for them.

I guess we just can’t have nice things.

I'd like to do that, but our software has to integrate with a ton of different other SaaS software which often has dumb first/last splits, so the dumb business logic often oozes across.
Do you ask users for both? i.e. "please enter your full name", "please enter the name by which you'd like us to call you"
I do!

The join form says:

- Your full name (e.g. Mary Smith)*

- Your short name (e.g. Mary)*

And I have placeholder text in the inputs with "Mary Smith" and "Mary".

My demographic is skewed to be about 70% female hence the female name example.

Exactly, but you can try to default the second one (using the same algorithm you’d use to generate “first name” unreliably).
And then there's sometimes a need for a "sort name" value. When I have upstream data consisting of separate first name and last name fields, my function to generate a sort name is to concatenate last name and first name, and then keep only letters. That way, apostrophes, dashes, spaces, etc. don't influence sorting whatsoever.

It seems quite tricky to deduce a sort string when you're only storing full name and short name... should the user be asked to provide this?

Why wouldn't you just accept the entire thing as a Unicode string and use the culture-free Unicode Collation Algorithm?
I don't mean to ask about or promote any particular sort algorithm. Rather, I'm discussing the transformation of a name into a "sort string," which will then be sorted (the algorithm you mention being a fine choice for this) after said transformation. Given discrete first/last fields, the transformation I mentioned works well for my purposes, but if I didn't have those particular discrete fields (instead having full/short fields) then it would be quite difficult, likely needing the user to weigh in, which I think is an atypical UX.
Because then you are sorting by the first name, and most people in Europe/America do not expect list of names to be sorted like that.