URL Dualism

Learn about URL dualism.

Duality in URL

We can use quotation marks when we want to talk about a word, rather than using the word itself. For example, we can say the word “verbose” means “using too many words.” It’s a bit like the difference between a pointer and a value; we understand that the pointer stands in as a way to refer to the value.

URLs have the same duality. A URL is a reference to a representation of a value. We can exchange the URL for that representation by resolving it, just like dereferencing the point. Like a pointer, we can also pass the URL around as an identifier. A program may receive a URL, store it as a text string, and pass it along without ever attempting to resolve it. Or our program might store the URL as an identifier for something or person, to be returned later when a caller presents the same URL.

Taking advantage of dualism

If we truly make use of this dualism, we can break a lot of dependencies that otherwise seem impossible.

Here’s another example drawn from the world of online retail. A retailer has a spiffy site to display items. The typical way to get the item information is shown in the figure below. An incoming request contains an item ID. The front-end looks up that ID in the database, gets the item details, and displays them.

Get hands-on with 1200+ tech skills courses.