Chances are good that you are building, have built, or are someday going to build a web application.1 So let’s take a high level look at what constitutes a modern web application, and how we got here.
Remember the 1990s? A time when gas was cheap, grunge was in, and people were still smarter than their mobile phones? Of course, it was also the decade in which the Web was born. Seemed like everyone had a “web page”, some people even had whole “web sites”, connected by “hyperlinks”. Ahhh, good times. Let’s take a look back at how web servers worked in those glory years…
Note: While the details have gotten dramatically more interesting (read: complicated) over the last decade, these basic principles still fundamentally power any web application you use or build today, so pay attention!
Request/Response is the Heartbeat of the Web
The core of the web is powered by a series of requests and responses. A request is most often made by your browser; it contacts an HTTP server, which is a just a program running on a machine2 with a public IP address somewhere. The job of the HTTP server is to look at the URL you are requesting3, and figure out what to send back to you. It acts much like a waiter, who brings your food requests to the kitchen, drink requests to the bar, and maybe the occasional request to the maître d’ or the valet. The HTTP server will process requests for a web page to one place, for an image to another place, and may even redirect your browser to an entirely different server to handle some requests.
Note: It turns out that humans are pretty sloppy when it comes to writing HTML, and browsers over the years have grown extremely forgiving. The code shown here isn’t “proper” in a strict sense. The syntactically valid version (that a good developer ought to be writing) is more verbose, but follows the same basic principles.
Basic HTML
For those that forget the HTML they learned from a 700-page Teach yourself HTML in 21 Days book in 1996, here’s a quick reminder. This is basic stuff, but stick with me, and we’ll see how it evolves into the “real” web applications we build today.
Web pages are just boring text files.4 What makes them special is that they have formatting tags defined by HTML right inline with the text. Here’s an over-simplified HTML text file:
Favorite Quotes
Seymour Cray famously said:“The trouble with programmers is that you can never tell what a programmer is doing until it’s too late.”That is so true, don’t you think?