Skype
Yahoo
What is the reasoning behind allowing only letters as the first characters of a username?
What is the reasoning behind allowing only letters as the first characters of a username?
An advantage of this restriction is URLs.
If a user's ID is 177896 and their username is H4rold, then you can have 2 URLs to reach this user depending on which information you have at hand:
http://example.com/user/177896
http://example.com/user/H4rold
Then, on that page, they determine how to look up the user by checking whether the first character is a letter or a digit. Alternatively, they could just force you to include at least one non-numeric character, though that increases the complexity of the check from a character comparison to either a regular expression or a looping multiple-character comparison.
However, not all websites with these restrictions take advantage of this flexibility. My theory is that web developers have seen this restriction so often that they just took it as the norm rather than investigating its purpose... We do that, sometimes.
I can think of no compelling UX reason for this. It is especially annoying when a username is taken, and a simple numeric variation is rejected. Great, now I have to remember another set of credentials.
So, from a UX perspective: no, this is not good practice.
There is usually a restriction on variable names in languages starting with characters ( and not including spaces - ALGOL was a notable exception to this, which allowed pretty much anything, becasue it used other methods for identifying a variable ). It may be that this idea has progressed into username definition, but there is not reason for this.
IME, as a software developer, there is absolutely not reason for insisting in a character at the start. And it is wrong to make these sort of restrictions when there is no real reason for it.
It might have something to with the fact that in XML, an ID has to start with a non-numeric character.
IsIdent
function is (unjusitifiably) used to check the user's name and IsIdent imposes this limitation.
Commented
Jan 14, 2012 at 16:21
In the early days before PCs became ubiquitous, numeric-only IDs were the norm. Examples of this are phone numbers, various identity numbers (SSN), even usernames on some early computer networks (CompuServe).
The requirement for a first character to be a letter could have been a way to encourage users to create readable usernames and break their habit of choosing only digits. Even if this rationale no longer applies, the restriction may stick around out of habit, or to allow working with legacy systems.
Aside from what others have written, there is really only one other reason I can think of. In many programming languages (such as PHP, JavaScript, etc...) variables must start with a non-numeric character (as mentioned in several answers).
Based on that and depending on how the programmers use the information, it could be they plan to turn the username into a variable at some point for at least one purpose or another. This may sound odd because you would think "why would anyone do that? It would be hard to program a variable if the variable is always changing". However, PHP supports variable-variables. Though not used often, they do have their moments. If they do create variable-variables, then they would need to insure there is a proper character at the end.
I know it's a long shot, but that's the only other reason I can think of.
$username = '1messed-up^user!name@'; $$username = 'foo'; echo $$username;
will run just fine and output "foo"
. And if you look at the symbol table using get_defined_vars()
, you'll see that the variable 1messed-up^user!name@
does indeed map to the value "foo"
.
Commented
Jan 20, 2012 at 15:13
This may be an attempt to enforce more legible usernames. We're used to referring to people using names that are comprised of letters and words, whether it's a legal name or nickname. For online handles, we may append numbers to the nickname to create variations on a name that's already taken, and most people will conveniently ignore the numeric suffix.
From a usability standpoint, bob316
is a much better username than 316bob
because:
It's easier for others to identify you as simply "bob" when they see the name portion in front. Putting the name in front makes it stick out more, and it should be easier for others to read the username until they hit a number and discard the rest rather than read the numbers until they hit a letter and begin parsing the name.
Similarly, it also makes it easier to scan for the person's name visually without knowing the numeric portion of their username. It's much easier to ignore numbers after a name than having to look for where the actual name begins in a string of characters. Also, we read largely by looking at the outlines of words, so distinctive word outlines facilitate reading (also why all-caps is harder to read than normal capitalization). Numbers have less distinct outlines than letters/words, so having them in front would make it harder to identify during quick scans.
It makes it much easier to find the username in an alphabetical list. If you know your friend's name is "Bob" then you can simply look in the "B" section of a list or directory rather than checking every number.
It makes auto-complete easier to implement. It would take longer to auto-complete if I were to type in "316bob" since the most unique/relevant part of the username is at the end; and simply typing "bob" would not get the suggestion of "316bob" in many systems. (Not strictly a usability issue, but ease of implementation does increase user access to this usability feature in practice.)
In addition to usability, a website might also discourage or forbid users from starting their username with a number because of compatibility issues. For instance, subdomains can't start with numbers (at least according to cPanel), so it makes it easier to have personalized subdomains for each user this way.
As noted by the answers, I don't think this is related to usability. Like Shroedingers Cat my first impression is that this is related to the restriction of variable names or other identifiers in software; usernames have simply inherited these restrictions, possibly due to habit or re-use of validation code.
The question is, why were other identifiers restricted this way?
Some possibilities:
If you want to use "7d" to denote "7 in decimal" or "7 as a double-precision floating point number" then that immediately rules it, and anything like it, out as a variable name. Something like 7d = 7d;
would be ambiguous at best and dangerous at worst. Similarly names with only numbers are right out.
It makes parsing easier if you can assume that any token beginning with a digit is a number. Writing a regex that handles forms like "7001", "700d", and "700dd" appropriately is more complicated if you're using some of them as identifiers. (Not to mention that 700dd is a valid hex number, so you'd have to account for a prefixing "0x" or similar as well.)
The use of whitespace and line numbers could also be a factor; see Roy Dictus's answer on a related Stack Overflow question.
These issues can be overcome, and some programming languages allow identifiers that start with digits, but it's certainly true that it's easier and simpler to disallow it. Allowing it doesn't provide anything that I would consider a benefit in exchange for the complexity (however slight).
Now it is entirely possible that there are some usability-related reasons for this as well. Pure speculation:
Before login systems like this and usernames like surferdude99
were common, I would presume that an architect of such a system thought of identifiers as actual, you know, identifiers. Something like matt.read
. Given two people with the name name, matt.read1
and matt.read2
make perfect sense. 2matt.read
is less natural and certainly something like 27blah234q
doesn't mesh with that system, so number-first identifiers were disallowed.
Something like 99OO
looks like 9900
. Of course OO99
suffers the same issue, but people are less used to seeing numbers with leading zeroes, so only the former case was disallowed. Possibly, the common standards of case insensitivity and presentation of usernames as all lowercase are related to solving these problems.
String username = '700dd'
. I haven't found any compiler that confused the string "700dd" as a hex.