Thursday, February 14, 2008

document.write("Learning JavaScript")

Well, it's happened. I have begun to learn JavaScript. I know—nobody is more surprised about this than me.

Some background, for those of you just joining us: Way back in the mists of time, circa 1995, the once-mighty Netscape Communications corporation decided that the future of the Web involved offloading some of the required processing power to the users' own processor, rather than depending upon servers for everything a Web page did. This was important, in a world of dial-up modems. The chief benefit, though, was that letting the users' computer chew on things allowed for a degree of interactivity we had not seen, before. They named their creation LiveScript, but a lot of light and heat in the tech world of the day centered on Sun Microsystems and their new programming language, Java. At the last minute, Netscape's scripting language was renamed "JavaScript" even though JavaScript has about as much to do with Java as Lightning Bugs have to do with Lightning.

Kewl! But what does that all mean?

It means that, using a client-side scripting language allowed for Web pages that reacted to various actions a user might take. Hover your mouse over a menu, for instance, and you might hear a click or a beep and the menu itself might grow or expand or change in some meaningful way. From a user-interface standpoint, this was pretty cool. You could now provide some useful feedback to your users that they were hovering over a link. But like a lot of tools, JavaScript could be misused, too. A great many pages were built that required JavaScript. If your browser was one of the few that did not have JavaScript, you were out of luck, as were the more paranoid among us who had JavaScript-enabled browsers, but who had turned JavaScript off in hopes of somehow enhancing their online safety. A movement began to use JavaScript to enhance necessary things like navigation, rather than to replace them.

Concurrent with all of this, we saw a rise in the use of Cascading Style Sheets, CSS, for many of the actions JavaScript was famous for. And the mighty Flash juggernaut continued to gain steam and Flash allowed for all kinds of actions and reactions to user input. So for a period of time there JavaScript was on the wane.

I was really happy about all of this, and long held the theory that JavaScript would become the Web's first dead language. JavaScript would become Web Latin. I remember the day a few friends decided to study JavaScript and asked me if I was interested in joining them and I told them no. And for a few years there, I was happy with my decision. I saw fewer and fewer pages with complex JavaScripts and so I must have been right.

But then one of those geeks with no girlfriend who spend their evenings moving the cutting edge came up with something new. AJAX arrived early in 2005, providing Asynchronous JavaScript and XML.

We have talked about XML, before. XML, the Extensible Markup Language is the future of the Web. I have noodled around with a little of it, and it's pretty cool. You can actually write your own tags in XML. It's all about describing the content of a page, though. To an even higher degree than using one of the strict document type definitions, XML separates content from presentation. Think of your <title> tag. It doesn't apply italics or change the color of your page title, it only titles the page. XML is all about that kind of thing.

Asynchronous roughly means "no timing" and in this instance means that the communication is more akin to a telephone than an old CB radio. Saying "Over" is the hallmark of synchronous communications like two-way radios. I talk. I indicate I'm done talking. You talk. You indicate you're done talking. I talk again. On the phone whether or not I'm talking has no bearing on whether or not you talk. It's possible to interrupt someone, on the phone. So that's AJAX, then. XML being monkeyed with at any given time, using the magic of JavaScript.

We'll see…. But I now have a renewed empathy and respect for anyone who is learning anything new about the Web. And it appears that learning new things about Web development is something that isn't going to stop, or even slow down, any time soon. I am a long way from AJAX, where you download a page and all kinds of additional stuff that may or may not appear or happen, depending upon what you point at or click on, without any further interaction from the Web server. But I am dipping a little toe into the JavaScript waters, and we'll see how this one goes.

No comments: