1

In my application, we need to assign unique identifiers to users, but this is turning out to be trickier than I would have thought.

We load all users from a bulk feed, and do all the assigning programmatically. Users can't pick their own.

We also want all user names to be the same length, for certain display purposes.

Also, the users are students in a school district, and they are children, some of them quite young, so the names have to be short and reasonably memorable. So just generating a 7 digit code isn't very user friendly.

We know the name of each child, but there are laws about identifying children. We wouldn't want, for instance, someone to be able to post a screenshot of their username online and have someone be able to identify their real name.

My first idea for this was to choose, say, the first 3 characters of the first name, the first 2 characters of the last name, and then append a sequence number to avoid collisions. So mine would be something like josfr123.

This failed, though, because some kids have names with fewer than 3 letters. But the more damning problem was that a small number of these combinations produced swear words, and that is so bad in software for children that we can't allow it to happen even once.

It turns out to be surprisingly hard to prevent this, because there are so many combinations of letters that don't spell anything, but if you tried to read them out loud, you'd get something obscene. Catching all of these, reliably, seems impossible, and even if I could, I'd still need to find some way to generate a name for that user.

So what to do?

1 Answer 1

3

For a modern system the answer is probably emoji.

In short, you are looking for a username that is:

  1. Unique
  2. A uniform length
  3. Memorable
  4. Not only numeric
  5. Not user created
  6. Not obscene when written or spoken
  7. Not reversible

As long as your system supports Unicode, you could assign a random set of 4 emojis to each user as a unique ID. Even if you limited it to only 80 animal symbols (to avoid trouble with #6), there should be over 40 million possible IDs. It should be fairly easy for even a young child to find 🦊🦋🐢🐔 on a list if they know what they are looking for or enter it into a login prompt.

If your system/database is limited to traditional ASCII characters (A-Z, 0-9), there may not be many option unless you can loosen some of the criteria.

A uniform length is probably the tightest restriction, as it will eventually exhaust the memorable strings, or even all the values if it's too short. If you can lift that restriction, you can assign a couple random dictionary words to each person. You might need to double check the word list to avoid running into #6, but that might also be a fool's errand. Children can read double meanings into everything and slang is constantly changing. A safe user ID today could become a derogatory term by the end of the semester.

Giving up on it being memorable would be the next easiest restriction to lift since you'd be able to use any random string you like. Obviously, this isn't the preferred option (and I already feel bad for any elementary schooler forced to memorize "ed5331aa90" to turn in their homework).

A possible workaround for using an emoji-based solution on older infrastructure could be to render the user ID as emoji to the users, but store it as the Unicode values behind the scenes. You could track user 1f98a1f98b1f4221f414 but the kid only has to remember 🦊🦋🐢🐔.

3
  • This is brilliant! But I'm not sure about how it would work in practice. For one thing, how would you enter it for login? The kid is unlikely to know the unicode for the frog emoji, and if you have to use a special on-screen animal picker UI, instead of the keyboard, that could get tedious. Also, older kids might find it silly. I'm also wondering about communicating the name, and searching for it. Like when the teacher says the kid can't log in, the first question is "what's the login?", and then we have to search for that in the database with a SQL query, which might be tricky here. Oct 10, 2019 at 19:15
  • I would wager that any kid with a smart phone knows how to type emoji using an onscreen keyboard, so all you would need is a way to get it or something similar to display on desktop systems. Mac does it through Ctrl+Cmd+Space, but it might be possible via a custom button. Teacher searches could be similar, but if your database doesn't support queries or displays with Unicode you might have to build a translation tool to turn 🦊🦋🐢🐔 into 1f98a1f98b1f4221f414 for the teach to copy & paste. Oct 10, 2019 at 19:34
  • 1
    I implemented this, but as a first phase, I'm generating a 5 alpha character string AND strip known obscenities AND show the string to the teacher first, and let her regenerate if the characters still happen to spell anything objectionable. In future, we'll map the letters to emoji's. Thanks for the suggestion! Nov 19, 2019 at 22:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.