| UserName or Username? |
| Monday, December 10 2007 |
|
I spend a lot of time focused on API design. A *lot* of time. One of the biggest areas of API design is naming (I'd argue it's actually *the* biggest area because everything starts with how things are named). One of the naming items that causes more thought than others is the word "username" (or is it "userName", or "Username", or "UserName"? - I'll get to that in a second).
As a society, we've gotten to the point where seeing username is routine. Everywhere that requires credentials via a login form displays it. Most ask for a username while others will ask for an email address, which is used as the person's username anyway. We've become quite adjusted to this and it's part of our daily routine for a whole host of activities.
But when used as a proper noun, what is the correct spelling and capitalization of the word? Is it Username or UserName? The answer also determines what the camel-cased version of the word will look like when used as a variable or parameter.
For awhile I had always went with UserName, which would lead to userName when used as a variable or parameter (assuming you're following solid API design guidelines). But it never felt right because userName just doesn't look or feel right, especially when compared to username. After looking around the web for awhile, I noticed that Username and username were most commonly used, but I couldn't find a definitive answer. I even went spelunking through some of the .NET code with Reflector and found a little bit of UserName and a little bit of Username, although it should be pointed out I never found userName, just username.
Out of curiosity, I opened Word and typed a sentence with UserName. It immediately underlined the word with the little red squiggly that means it's spelled wrong. Sure enough, when I right-clicked on the word to get suggestions for proper spelling, Username was at the top of the list.
I don't know about you, but that's a good enough definitive answer for me. From now on Username and username it is.
And you know, if you really break this post down, it's all about one letter - N - and whether or not it should be capitalized. I'm freakish, what can I say?

8 comment(s) so far
So does that mean you also do Firstname/firstname and Lastname/lastname?
It is quite the conundrum, I agree. I am personally okay with UserName.
And to answer the previous comment...I have seen many APIs that have properties for classes that say FirstName and LastName.
Using the second capitalization, like UserName is technically improper English. Yet I use it all the time in my filenames because it's easier to read--otherwise all the letters just jumble together and don't make distinct words.
"Username" is probably the most grammatically correct.
FirstName and LastName are a little different. The main point is whether "username" itself has become an accepted word, as opposed to the variable name "UserName" or "User name" where it is two separate words used together. First name and Last name are still and will likely remain recognized as two words, however more and more, username is getting recognized as a word on its own. Although right now, the Firefox spell checker doesn't agree. :)
Personally, I prefer "Username" / "username". The word has become common enough to be accepted, IMO, and looking at how it is used in the front end as opposed to the UI, how many websites do you see asking for you "UserName" or "User name" as opposed to just straight "Username"?
case sucks. it should be username, dave. i may never use the shift key again.
check out the microsoft style guide for technical pubs...they'll tell u the correct spelling for publication and user interface stuff.
http://www.amazon.com/Microsoft-Manual-Style-Technical-Publications/dp/0735617465
I don't think anyone would ever approve of UserName in a published guide/material. It's either User Name or username. That's it. My guess... user name
As a society :) , I am sure most of don't care too much, as long as it gets the point across.
Checked out the MS Manual Of Sytle referenced earlier in my post on amazon. In the index, it lists as user name. Two words.