What do you mean by not signe

Another solution could be to append the user id (which should be unique) to the input URL. However, if the user has not signed in, we would have to ask the user to choose a uniqueness key. Even after this, if we have a conflict, we have to keep generating a key until we get a unique one.

In this chapter, I saw the above info but I don’t quite understand it. if the user has not signed in, should we just not provide shorten URL service? For the uniqueness key, what case would cause the conflict?

Type your question above this line.


Hey @Andy_Shun

Thank you for contacting us.

URL shortening service only maps a unique URL to a shortened unique URL, so if two users use the same URL, the URL shortening service would generate the same identical URL for both the users, to avoid this and to generate unique URL for each user we will use URL shortening service with some way to add uniqueness in the URL. That is why for the user that is not signed-in we are not only relying on URL shortening service.

For the uniqueness key, if the user enters a key, and that key is already generated by some other user, then the URL will become identical, so to solve this problem we will keep asking the user to generate the key until and unless the user enters a key that is not generated before. This case is only for the user that has not signed in, if the user has signed in then we use their user_ID as a key instead of asking from user, because each user has unique user_ID.

We hope Educative has inspired you to further your learning :slightly_smiling_face: