Archive for July, 2007

JavaScript Rising

Wednesday, July 11th, 2007

In this post I wondered why no one (that I knew of) had proposed using JavaScript as a server-side language, and developed tools to support it. Well, they say it steam-engines when it comes steam-engine time. A lot of other people had the same idea; and unlike me, some of them did more than just blog about it.

Googler and blogger Steve Yegge (whose keynote at OSCON I am going to miss, dammit) made a splash by porting Rails to JavaScript — specifically, the Rhino JavaScript-on-Java interpreter that is bundled with Java SE 6. He calls it “Rhino on Rails”, the clever bastard.

In an effort to increase developer productivity at Google, Steve tried to convince the company to adopt Rails (and consequently Ruby) as a programming language. When that fell on deaf ears (Google really does not want to increase the number of languages that must be supported by their infrastructure), Steve decided to do what any other frustrated programmer would do: he ported Rails to JavaScript. Line by line. In 6 months. Working 2000 hours. Steve is a coding stud.

And he is not alone: witness Project Phobos.

Phobos is a lightweight, scripting-friendly, web application environment running on the Java platform.

It comes with a set of plugins for the NetBeans IDE that cover the complete development process. These include a fully-featured debugger; wizards to help you get started faster; a palette of Ajax widgets that can be dropped on a page, thanks to jMaki; and the ability to generate a standard web application for deployment on any servlet container or Java EE application server.

Currently, the primary language supported by Phobos is JavaScript. By leveraging JavaScript on the server, Phobos allows developers to use the same language on the client and server tier of a web application, eliminating the impedance mismatch that characterizes other approaches to Ajax.

Digging farther back in Steve Yegge’s archive, one finds he has been thinking along these lines for some time:

JavaScript is probably the most important language in the world today. Funny, huh? You’d think it would be Java or C++ or something. But I think it just might be JavaScript.

For one thing, despite JavaScript’s inevitable quirks and flaws and warts and hairy boogers and severe body odor, it possesses that magical property that you can get stuff done really fast with it…

See, JavaScript has a captive audience. It’s one of those languages you just have to know, or you get to miss out on Web programming, and in case you hadn’t noticed, thick clients are like Big Hair these days. Most non-technical people I know pretty much live in their browsers, and they only emerge periodically to stare in puzzlement at iTunes or a game or something, and wonder why isn’t it in the browser, because everything else useful seems to be. It’s where the whole world is. To non-technical people, of course. Which is, like, practically everyone.

What other language is supported, in a reasonably cross-platform manner, on the Windows, MacOS X, and Linux native APIs, the Java virtual machine, the .Net virtual machine, the Parrot virtual machine, the Flash runtime, the Silverlight runtime, and 99% of the web browsers in the world? (And, oh yeah, what’s that new thingamajig from Apple? I vaguely remember reading something about it. Can’t seem to recall the name…) In other words, JavaScript not only runs on every platform of interest; it is the only language that runs on every platform. [1]

JavaScript isn’t winning the fight to be the Next Big Language; it’s already won.

[1] Actually, I don’t know if it runs natively on PlayStation3 and XBox 360. But given the little-bitty interpreter and the great big storage media, the games could ship with their own JS runtime and not miss the space.

Transporting a Virus Across State Lines

Tuesday, July 10th, 2007

Flew to Oklahoma City on the morning of the Fourth. Traveling early seems to be the way to go; I made it in time to go see the fireworks, and on the trip back (also in the morning), I had decompression time before going to work… if I had gone to work as planned (more on that below). I dislike both air travel and early rising enough that motivating myself to get out of bed to go to the airport is a bit of a challenge, but I somehow managed it.

My friends and I sat on the Robinson bridge across the Oklahoma River (still seems funny to call it that; it was the North Canadian when I grew up there) and watched fireworks. There was a professional display over the ballpark in Bricktown, but that wasn’t what we were watching; the amateur pyromaniacs were out in force, and they kept some pretty impressive fireworks going more or less constantly for over an hour. Gary remarked that there were small towns around whose professional shows couldn’t match what we were seeing from the folks by the river.

Anyway, I got to visit with my mom and with Paul a bit, got the brakes fixed on my mom’s car, and got her PC beaten back into shape (Windows updates, Firefox update, reinstall the firewall, scour off all the adware, etc.) All in all, a pleasant visit. I also got my mom to try Indian food, and she liked it. (Gopuram on NW 23rd; highly recommended.) Finished it with movie night at Leonard’s, where the theme was Dinosaurs. (There are actually a few good dinosaur movies out there. Those aren’t the ones we watched.)

Just before leaving for Gopuram, I started to feel a bit off in my stomach. (Thus, the restaurant was not to blame for what followed.) I ate too much, of course — it’s a buffet for pity’s sake, and I am but a weak-willed mortal — and left feeling stuffed. The stuffed feeling stayed with me all through Dinopalooza, and left me restless all night. And I started to feel an ache in my lower joints, which is my body’s way of telling my I have the flu.

Still, despite the restless night, I was feeling semi-human in the morning, so I packed up and took the flight home. I got home, plopped my bags in the hall, and after checking in with my mom by phone, laid down to catch up on sleep; I felt like crap, but chalked it up to lack of sleep. But waking up hours later, still feeling like a reanimated corpse, I realized that the damn virus wasn’t done with me yet.

Woke up during the night with chills. Teeth-chattering. Got it together enough to turn the airco off, add an extra layer of shirt, and get back into bed. When the chills eventually passed, and it got close to time to decide whether to call in sick or not, I took my temp: 101.6. Who knows what it had been earlier, when the virus was riding high?

Even without the fever, work would have been a dicey proposition; I was wrung out. I emailed an out-sick notice, and crawled back under the covers, and spent all morning and half the afternoon asleep.

Anyway, I’m better (even if my digestion isn’t quite right yet) (don’t ask), and I did a day at work without incident.

I suppose I should go unpack now. But Livvy-kitty has decided that my bag full of dirty clothes is her new favorite pillow, and I don’t think I’ll take it away from her just yet.