educative.io

Educative

TinyURL - Why "Multiple users enter the same URL, they can get the same short URL, which is NOT acceptable"

The title was a quote from the original course text. Why same URL → same short URL is not acceptable? High doubt this is a typo.

1 Like

Hi @Michael_Educative

In the same lesson, the functional requirements of the system are mentioned under the heading Requirements and Goals of the System. It is mentioned there that:
( Links will expire after a standard default timespan. Users should be able to specify the expiration time)
So keeping this requirement in mind, we cannot give the same tiny URL to multiple users who enter the same URL. Because if we do so, there would be a conflict in the expiry date for multiple users.

Yes, there could be some URL shortening service that doesn’t have an expiration date, then the scenario would be different. But the proposed solution in the lesson has expiration as a functional requirement.
Hope you get it. Happy learning :slight_smile:

5 Likes

Thank you! Your explanation makes a lot of sense.

Just to add to you thoughts.
If I’m thinking right, if we want to add additional features like statistics of a shortened URL based on user, it would be more suitable if different tiny URLs are returned for different users.

1 Like

Wont the uniqueness of the data returned be based on the the user+the encoded url? You’d be getting the data based on the user requesting the data for the ones that they created. In that case, uniqueness of the encoding for 2 or 200 users could be the same for same url since the user ids in the database will be different.


Course: Grokking the System Design Interview - Learn Interactively
Lesson: Designing a URL Shortening service like TinyURL - Grokking the System Design Interview