156: URLs, URNs, URCs, Data URIs, and URIs.
Take Up Code - En podcast af Take Up Code: build your own computer games, apps, and robotics with podcasts and live classes
Kategorier:
It’s almost a tongue twister to say them all. Do you know what they all mean? Let’s take URI one step at a time and at the end, you’ll understand how best to describe where information such as web pages can be found. The whole point though about this is that it applies beyond just web pages. You’ll have a solid understanding of how to describe where almost anything can be found. The first part is Uniform. This means that you can describe completely different kinds of resources that might have very different mechanisms. Just take web pages vs. emails as an example. The URI document describes a uniform way to represent these and other types. But types of what though? Here’s where things get really vague. We’re talking about resources and these can be almost anything. A web page is a resource. But so is an online service that provides high scores for a game. And you can even describe resources that are in the real world and have nothing to do with computers at all, such as a library book. If you thought that was vague, the term identifier is even more so. This is whatever is needed to uniquely refer to one thing vs. something else. It can change depending on what type of thing you’re trying to identify. And it might not even be a single thing. Maybe it can identify a group of things where the group itself is important somehow. But probably the strangest part of an identifier is that there doesn’t actually have to be anything located or found at whatever is identified. It could just be an idea or a concept. All that really matters is that it has some kind of identity, whatever that means. URIs are interpreted consistently no matter where you are but that doesn’t mean that they provide the same result. The RFC 3986 document describes http://localhost as an example. No matter where you are in the world, this always means the same thing. It refers to the computer itself. Each computer will interpret this URI to mean itself. The way that URIs are able to handle such variety is because they start out with what’s called a scheme. The “http” in http://localhost is the scheme. This says that what follows should adhere to rules specifying valid http addresses. If you wanted to represent a phone number as a URI, then it would begin with “tel:” And an email address would begin with “mailto:” Make sure to listen to the entire episode to understand what are URLs and URNs as well as when to use them. Or read the full transcript below. Transcript RFC 3986 says that: ◦ A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource. You can read this document online by searching for RFC 3986. RFC stands for “Request for Comments” and 3986 is the specific number that the IETF has given this document. But what’s IETF? Well, if you visit www.ietf.org, you’ll find their goal is to make the internet work better. That’s a very big goal. IETF stands for the Internet Engineering Task Force and they help create standard documents that describe things like URIs. Now you might wonder why we need such complicated documents to describe simple concepts. All I can say is that there really are a lot of small details that do need to be documented. And if small details are not documented, then they have a way of being interpreted differently each time a developer needs to work with them. In fact, even with such specific documentation, people still get confused. Some people say that we shouldn’t worry so much and just call everything a URI. I know, I haven’t yet described what all these URLs, URNs, URIs are. I’ll get to that. I wanted to first give you some perspective on what all this is about and where you can find out more. There’s no way that I can describe all the details in one of these official documents. At least not if I want you to stay awake. Just lo