Wednesday, January 13, 2010

The Scripting

One of the things I’m going to try to do better this year is starting these things. I never know when to begin a story, you know? Some people like that, some are annoyed by it. The first time I met my wife, we talked of course about What We Did and when she found out I was involved in computers, she asked how they worked? I stumbled around through Herman Hollerith and Blaise Pascal and eventually all of the way back to the abacus. She came back, and we have been together more than twenty years, now. Is it any wonder I love her so? But I need to do a better job at making beginnings.

So… the Earth cooled and the dinosaurs came. Flash ahead a few years and the Pioneers started putting up Web pages. These were terrific! They offered all kinds of information on all kinds of topics. And they provided links to even more information. You could start out looking up information on where the Holiday Inn is, in Rockville, Maryland and end up learning about how many different kinds of marsupials we have discovered.

But, as with most technologies, we were more adapting than adopting. We were taking the familiar, the books, magazines and newspapers we had all grown up with, and we were putting that kind of information online. Is that progress? We were using $2500 computers to absorb information we used to get for 25¢ from a newspaper. It’s hard to say we were really better off, though the colors were brighter.

We had all of this brain power just sitting there, warming our offices. Couldn’t some of that be harnessed for Good? A computer is fundamentally different from a book, magazine or newspaper. Couldn’t those differences actually be made into advantages?

We developed two kinds of ways to make our pages more thinky. Depending upon what a user was doing with a mouse or keyboard, the look of the page and the information it displayed could be very different, very quickly. And these differences were brought about by using either the Web server, or by using the page visitor’s own computer. We say the technologies are either server-side or client-side today.

Static Web servers work like this: A user calls up a Web page and the server ships it off. That’s it. You get the same page everyone else gets, with the same information on it. If that information ever needs to change, someone has to edit that particular Web page and make those changes. Then everyone will once again get the same, new, information.

Server-side scripting works like this. A user calls up a Web page and the server ships it off. But this time, before it puts the page on the train to your computer, the server goes through the page, line-by-line, looking for little instructions. “Go ask the computer what day and time it is, and put that information here”. “Go ask the computer how much this guy owes, and put that little piece of data there. The changey aspects of the page are all handled by the machine that shipped the information to you in the first place.

Client-side scripting works a little differently. This time, a user calls up a Web page and the server ships it off to them. The page still has little instructions in it, but this time they are for the user’s computer. The computer that displays the page will in some ways be controlling how it looks and works to the viewer.

Imagine a tiny little shoe store. Imagine Amazon.com. The little shoe store probably has a server under the cash register, and may get dozens of hits per day. Amazon gets tons of traffic every minute. The shoe store folks may, in fact, build a new Web page for every shoe they sell. But a store like Amazon.com could never operate that way. They have pages that include various routines to call upon databases and aggregate information in ways nobody could imagine a hundred years ago. The page you see at Amazon.com is probably unique to you and your computer. Nobody else is seeing the same thing in the same way. That kind of variety just isn’t economical if every page has to be marked up individually because they are static. Dynamic pages are the future, and if you’re interested, you should maybe spend a calorie or two looking into JavaScript, PHP and MySQL, ASP and other technologies to make your pages sing and dance.

No comments: