Yesterday, a friend of mine (Yashvin Veerappa) found this post about REST: “How I explained REST to my wife“. It’s one of the best descriptions of REST I’ve ever read…really well-written and easy to follow. It’s in the form of a dialog between a man named Ryan and his wife. After I read it I thought I could try to explain REST to my girlfriend too (I hope she’s not reading my blog…!). After all, explaining something to others is the best way to really understand it yourself.So, this is what happened when I tried to explain REST to my girlfriend over the phone (read the original first)!
Alex: Do you know Roy Fielding?
GF: No, never heard of him!
Alex: He is a really smart guy! He helped writing the first web servers and then did a ton of research explaining why the web works the way it does. His name is….
GF: Sorry, what web are you talking about? Was he an entomologist?
Alex: No, no, not spider web…hmmmm, I mean the “Internet“.
GF: Oh, so he is the one who built youtube? I saw the funniest video yesterday about…
Alex: No, no wait, let me finish! He didn’t build youtube. Youtube is a web page. Fielding helped writing the first web servers which are machines where your browser connects in order to…
GF: What’s a browser?
Alex: A browser is a program that downloads and views web pages, like youtube!
GF: You know, for a computer scientist your knowledge is very limited…the thing you’re talking about is called Internet Explorer, not browser!
Alex: Well, Internet Explorer is a web browser but there are others as well, e.g. Firefox, Opera, etc. Let me give you some extra information here. Web pages are stored in web servers. So, when you want to see a web page, you open a browser and enter a URL…sorry, I mean a name like http://www.youtube.com, which is called URL. The browser then connects to a DNS server to find the IP address of the webpage…hmm, forget the last one, the browser does some “stuff” to find in which web server the web page is stored and then communicates with the web server and asks for this specific web page. The protocol which is used for the web, what you are calling Internet, is called HTTP. HTTP is capable of describing the location of something anywhere in the world from anywhere in the world. It’s the foundation of the web. You can think of it like GPS coordinates for knowledge and information.
Alex: Are you there?
GF: Sorry, I went to the fridge to get something to eat! What were you saying about youtube?
Alex: Grrrrr, I was saying….
(…and I explained the whole thing again!)
GF: Ok, so this HTTP thingy is used to describe the location of web pages, right?
Alex: WOW, amazing! Exactly right…actually almost right! HTTP is used to describe the location of resources, where resources could be anything. A web page is a visual representation of that resource. For example, in youtube, a video is the resource you want to find and is using a web page in order to be visually available to you!
GF: Oh, ok, I think I understand that!
Alex: The amazing thing is that these resources can be anywhere in the world and the computers have to communicate with each other in order to find them. If you want to find a specific resource, your computer will communicate with another computer, asking it about this resource. That computer might not have it but it will point out another computer that will have it.
Alex: Let me give you an example. You’re talking to your sister and she…
GF: I don’t have a sister! We are together for over 1 year and you still don’t know whether I have a sister or not!!!
Alex: Sorry, I was just reading an example of another webpage. Say that you’re talking to your brother and he wants to borrow your sweeper. But…
GF: Why would he want to borrow my sweeper? He lives in Germany and I’m in France…it would be easier to go and buy a new one from a local shop!
Alex: Grrrr, it’s just an example! So, let’s say that he wants to borrow your sweeper. But you don’t have it- your mom in Greece has it. So you tell him….
GF: My mom doesn’t use sweepers.
Alex: IT’S JUST A F$*^#ING EXAMPLE!
GF: Why are you yelling at me? Don’t you love me anymore?
Alex: I’m sorry, you’re right…I just got frustrated because if you don’t understand this simple example, how am I going to explain to you all the other things later, like polymorphism and ….
GF: Polymorphism? What’s that?
Alex: Well, in simple words it’s a way of classifying objects with similar attributes. Say for example you have an object called Woman, and another object…
GF: WHAT? That’s what women are to you? Objects?
Alex: No,no, it’s just an example, I didn’t…
GF: So I’m just an object to you, right? Maybe just a sex toy?
Alex: No, what I was trying to say…
GF: I know exactly what you were trying to say! I thought you were different, but all men are the same, you only have one thing in your minds…
Alex: Oh, fuck it!
(And I hung up the phone…)
(Just to avoid the possibility of being single after my girlfriend reads this, I should clarify that the above conversation is entirely fictional!)