tags:

views:

251

answers:

7

I am wondering why the link to profile looks like:

http://stackoverflow.com/users/ID/NAME

not simply:

http://stackoverflow.com/users/ID

or even better:

http://stackoverflow.com/users/NAME

Can there be couple users with the same name? Or can one user have many names?

+2  A: 

I would assume doing a database lookup solely on the name string would be more expensive than a numerical lookup on the primary key, even if the name column is indexed. The name is then added on to make the URLs more user and SEO friendly.

roryf
why lookup on string would be expensive? It would be little more expensive that by id, but it should not be a problem - many portals are using such schema...
rkj
Fair comment, revised to be 'more expensive'.
roryf
+2  A: 

There is a uservoice request for this. If you want this to happen, uservoice is the right place to discuss / vote up.

Serhat Özgel
+4  A: 

The part after the last slash seems to be SEO related (i.e. making the url more expressive).
On the urls that I tested you could replace that part with whatever you wanted, it still worked. So the url http://stackoverflow.com/users/37086/othername still points to your profile.

Ole
A: 

Try changing or removing the name and see what happens.

I think it's just so that your URLs tell you what to expect, but the application doesn't need (or actually use) that information.

Amazon does something quite similar with their books, if I remember correctly: They've got both the ASIN (their internal ID) and the name of the book in the URL, but only ever look up the ASIN.

Joachim Sauer
A: 

Just speculating: The ID allows very fast retrieval of the data the profile page presents. The name is just for humans and ignored since it's easier for me to no that you are rkj and I am phihag than that your ID is 37086 and mine is 35070.

phihag
+14  A: 

All SO-URLs are of the form id/description where the ID is unique and the description is optional. So /users/12890/arne-burmeister is the same as /users/12890/huhu and /questions/420380/why-does-the-link-to-the-user-profile-have-both-id-and-name is the same as /questions/420380/foo. The retrieval just uses the ID, but it is much better for google ranking, when the user/question/what-ever-should-be-found occurs in the URL (also for humans this is much more descriptive ;-).

By the way, retrieval by ID is faster than by such a large text string. And of course, the URL remains valid if someone changes their user name or the question.

Arne Burmeister
I think this is an interesting answer that applies to more just SO. I like how if the human portion changes the right page is still served up.
JoshBerke
+1  A: 

Your name on SO is not unique click on users and type Josh, there's a whole page of us. So you have to have the ID. As for why the name everyone else's guess is as good as mine.

JoshBerke