Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I got this question in one of the interviews I took. I started by explaining that it is like a set of rules that should be followed while moving resources around, but I did not feel convinced. Is there any other analogy or take on this question ?

share|improve this question

closed as too broad by gnat, Bart van Ingen Schenau, durron597, GlenH7, Kilian Foth Jun 17 '15 at 20:55

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

To a lay person I would say "its how the internet works". – P.Brian.Mackey Jan 5 '12 at 14:12
How lay of a person is this? When I think Lay Person I think of somebody who doesn't even know what a bit or byte is, let alone a TCP/IP based application protocol. – maple_shaft Jan 5 '12 at 14:15
For the headers part of HTTP, see this :) – Lekensteyn Jan 5 '12 at 14:23
up vote 3 down vote accepted

One reasonable analogy might be speaking to someone on the phone. After all TCP/IP is very similar to phone call. So something along the lines of:

HTTP is like a language that computers on the internet use to talk to each other.

If you want something from somebody on the other end of the world, you phone them up and ask them and you have to ask them in a language you both understand. Requesting a web page from the internet works similar—your computer calls (it often even uses the same wires as phone) one in the company that made the page as asks it for the content—and HTTP is the language both computers understand.

share|improve this answer
Also "phone numbers" map nicely to "IP-numbers". DHCP-assigned ones map to "Buy a simcard and get a new number". – user1249 Jan 5 '12 at 14:46
This is a pretty good description, but I think it needs to be mentioned that its more like calling a customer service line, than another person. – Ryathal Jan 5 '12 at 14:48
@Ryathal I agree though I think "customer service" analogy crosses into DNS and the idea of how do we actually find the phone we want to call (web page we want to view). Either way I like it but no sure if that opens a whole new can of worms when someone asks ok so I got the web page, how did my browser know where to find it/I reached the person I tried calling, how does the system know where their phone is. – Chris Jan 5 '12 at 14:54
@Chris: That's outside of the scope of HTTP, but all still has plausible phone analogies. "The hostname part of the URL is like the person's name and the computer first calls special information line of the internet provider and uses special language, DNS, to ask it for corresponding number". – Jan Hudec Jan 5 '12 at 15:01
@chris actually i was thinking its more the the dealing with the press 1 to get to menu 2 is like the handshake process, and when you actually get a person they have no knowledge about any previous calls unless they provide a way for you to tell them about previous calls. DNS would be more like the switch boards that direct your call to that phone numbers location, not calling your ISP to tell them their service sucks – Ryathal Jan 5 '12 at 15:14

it is like a set of rules that should be followed while moving resources around

Although not entirely inaccurate, that sounds closer to a description of REST to me.

I would describe HTTP as a communication protocol, originally designed for Hypertext (hence the name) but extended over time to include any form of file (where the type is defined in the header).

I would also go on to explain that it is a request/response communication, rather than being completely bi-directional, and that the verb in the header is intended to describe an action to be performed, usually on a specified resource.

share|improve this answer

For a layman I would explain it as:

A way of requesting and communicating back the information on the Internet(World Wide Web).

I don't know if any further details need to be provided unless asked.

share|improve this answer

I have to do this a fair amount due to the nature of the business I work for. There are some good short explanations listed already. But the beauty of HTTP is it is really understandable. So when I need to get more in depth than the short answers above, I typically fire up a browser, ask the user for a favorite site then fire up Fiddler or Firebug or whatever other http debugger is handy. Then we walk through requests and deconstruct HTTP while it is in action.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.