The Source for Java Technology Collaboration
User: Password:



Ben Galbraith's Blog

November 2005 Archives


Embarassing Moments at JavaOne (and OSCON)

Posted by javaben on November 19, 2005 at 10:22 AM | Permalink | Comments (0)

(Cross-posted on Married... with children)

There are two experiences in my life that caused me such embarassment that though years have passed, when I reflect back upon them for more than a few seconds, I find myself subconciously curling up into the fetal position with a pained expression burned into my face.

These are not those experiences. But, they are experiences that were embarassing at the time.

Now that JavaOne is half-way upon us, I couldn't help but think back to an experience at both JavaOne 2003 and JavaOne 2004.

At the JavaOne 2003 show, I attended a Birds-of-Feather (BoF) session given by Kohsuke Kawaguchi, one of Sun's XML wizards. He was talking about his interesting JARV project, which incidentally was a strong inspiration for the new Validation framework in JAXP 1.3 (the JAXP bundled with Java 5). As the time to start his talk drew near, it became apparent that something was wrong. He was tinkering with his notebook in desperation, and soon that heart-dropping expression crossed his face that we all innately recognize -- and it was clear that his notebook just wouldn't boot. It was some PC notebook running some Linux install. Now, you have to understand, I've sat through a lot of presentations in my life. Mostly, they're accompanied by a Windows laptop running PowerPoint, and it always inevitably runs without problem. But, on the rare occasion that a presenter brings a Linux laptop, in my experience the speaker inevitably has problems getting the presentation to work. Nearly without exception.

So when this happened to Kohsuke, I found myself thinking, almost a little smugly, "This would never happen to me."

Kohsuke saved the day by whiteboarding his presentation live in front of all of us. And, it went pretty well! At least, I learned a lot about JARV and wound up using it quite a bit thanks to the excellent presentation. Great job, Kohsuke, on both the talk and the software.

Fast-forward to JavaOne 2004. I'm presenting a BoF in the same hotel just a few rooms away from Kohsuke's presentation. It's a multimedia presentation explaining how the GlooLabs Java-powered WiFi MP3 player works. I've got a great PowerPoint presentation, some multimedia demos, and live code examples all queued up.

And, just before the time to start, I take the AC adapter, already plugging into my trusty Windows laptop (IBM ThinkPad), and plug it into the hotel's cheap, dingy little power strip. And, you guessed it, bye-bye laptop. The LCD instantly turned off. I didn't panic, I just rebooted. I can't tell you how relieved I was as everything came up normally. The blood flowed back into my extremities and... the video died after about two minutes. And it died again after I rebooted. And again. In fact, I was able to reproduce that behavior for the rest of the laptop's (short) life. Plugging in an external monitor (e.g., the LCD projector) made no difference. The video card, my friends, was fried.

Ahhh, life's little ironies. I followed Kohsuke's example and whiteboarded my talk to a crowd of folks who came expecting to see the MP3 player in action. Folks were complimentary, but I felt really, really stupid. The happy coda to the story is that right after my talk, I crossed the street (both figuratively and literally) and bought my replacement notebook* at the Apple Store and have enjoyed being a serf in Steve's little Cult of Mac ever since.

While I'm talking about embarassing conference moments, I have to throw in one I had at OSCON 2004. I presented there too, though I don't think I did anything embarassing while delivering my talk. No, the moment came for me when I listened to Jim Hugunin talk about IronPython. So, I admit, at this point in my life, hating Microsoft was a personal hobby. And if there's any group that despises Microsoft more than the Scott McNealy of this era, it was the Open Source crowd.

So when Jim announced in his talk that he had accepted a job at Microsoft, I shouted out a playful "Boo!", expecting others to snicker or join in. Instead, everyone in the section of the room I was in turned around and stared at me, all effectively communicating, "What kind of moronic freak are you?" I sat pretty silent for the rest of the talk.

You know, while I'm at it, I have a near miss from JavaOne 2005 I'd like to share. I delivered two talks at that show; my "almost-embarassing-moment" comes from the Ajax BoF that Dion Almaer and I gave together. Our talk submission completely pre-dated the Ajax phenomenom -- we submitted it even before Google Maps came out, but just after folks were starting to notice XMLHttpRequest.

Of course, in the months that followed after the talk was submitted, the Ajax movement caught on and was incredibly popular around the time we presented at JavaOne. In the meantime, Dion and I had started Ajaxian.com, and we spent a lot of energy tracking the Ajax evolution. When it came time for our JavaOne talk, we treated the talk as an opportunity to teach folks about Ajax, and didn't pay much attention to the BoF abstract we submitted (with BoFs, you bring your own slide deck and do your own thing).

As it turned out, Dion and I had a few hours of spare time before we gave the talk. So we thought we'd have some fun. The first thing we did was code up a Google Maps engine from scratch. For months we'd been telling people it was easy and that they could do it in a few hours; we thought it was high time we walked the walk. And, as it turned out, we finished it in a couple of hours**. In the thirty minutes before the BoF started, as we were relaxing with Howard Lewis Ship, we thought, "Hey, why don't we add off-line capabilities to that Ajax RSS Reader we made?" So, about two minutes before the BoF started, we finished the off-line mode feature, which lets you download feeds by consuming Blogline's Web Services API and save the results of the feed to disk (yes, using JavaScript) so that even if you clear the cache and quit the browser, you can relaunch the browser and read your feeds, even if you're off-line.

The near-miss embarassing moment came when, as we presented the talk, more than a few people asked, "When are we going to see the off-line mode?" That caught us completely by surprise, because to us, we were talking about Ajax, but, of course, in the abstract, that particular aspect of the presentation was given prominent mention. We were happy to demo the off-line mode that we had just barely finished coding, but man, that would have really looked bad if we had said, "Err, yeah, no off-line mode, but what do you think of this neat Ajax effect?"

Ahh, memories. I wonder what JavaOne 2006 will hold in store?

* The change of term from "laptop" to "notebook" here is more than stylistic. Those PowerBooks run HOT! In fact, if you read the manual, Apple clearly states that -- get this -- it's not designed to be used for extended periods of time ON YOUR LAP. Which is why, if you study their materials, you will never, ever see Apple refer to their PowerBook notebooks as "laptops." They're not.

** If you're interested, our upcoming Pragmatic Ajax book has the code from that experience, demonstrating how you too can build your own Google Maps style UI.



Give Me My Commodity Text Widget Features, Please

Posted by javaben on November 19, 2005 at 09:18 AM | Permalink | Comments (6)

(Cross-posted on Married... with children)

One of OS X's pioneering features was giving check-as-you-type, right-click-suggest spell checking to every application that wanted it, free of charge. It's so nice to be able to focus on writing without worrying that I've made an obvious spelling error, or, even better, intentionally mispelling a word so I can get instant access to the right variation -- and being able to do this in almost any context.

Amazing that years later, something that useful and handy is absent from the Java Desktop stack* and Windows. In the meantime, Apple took it a step further with the latest release of OS X: a commodity dictionary.

The next text widget feature I want to see commoditized is auto-complete. I've been authoring some documents in XML and XHTML, and my text editor memorizes every word I've entered and offers autocomplete options (if I request them). It's addictive and productive. And I want it everywhere -- especially in my Swing applications.

* If the service isn't present natively (and on Windows/Linux I don't imagine it is), just provide a Java native version



How I Learned to Love Domain-Specific Languages (in Three Parts)

Posted by javaben on November 16, 2005 at 08:14 PM | Permalink | Comments (20)

(cross-posted on Married... with children)

I've been watching the hype surrounding domain-specific languages (DSLs) with skepticism. At first I thought, "Why would I learn some custom syntax when I could use good old Java and XML?" And then, gradually, I saw the light.

Dave Thomas was the catalyst behind my change of heart. Over dinner a few years ago, he patiently explained to me why the Ruby community eschewed XML for YAML; that angle brackets and wearisome complexity make XML more pain than it's worth.

At the time, I sputtered various protests about how XML was a lingua franca, readily-understood, blah blah blah. But it got me thinking -- and the next time I edited an Ant build file, my discontent was a bit more pronounced than usual.

Shortly thereafter, James Duncan Davidson came out with his "I shudda used a scripting language" post (couldn't find a good link, sorry, but this fragment gives you an idea), and that got me thinking some more.

As the Rails machine started dominating the Ruby discussions, Dave's anti-XML chorus found a whole new host of supporters, this time advocating in addition to YAML the use of the value of domain-specific languages instead of general-purpose configuration files. About the same time, my friend Neal Ford started banging his own domain-specific language (a.k.a. language-oriented programming) drum.

"Hey," I started thinking, "maybe there's something to this 'XML bad, DSL good' meme."

The funny thing was that all throughout this time period, though I didn't realize it, I was already preferring a DSL to XML. RELAX NG (a blissfully simple alternative to W3C XML Schema) comes in both XML and DSL flavors, and I'd been preferring the DSL for months. Have a look, starting with the XML version:

<?xml version="1.0"?>
<element name="contents"
         xmlns="http://relaxng.org/ns/structure/1.0"
         ns="http://galbraiths.org/myns">
    <oneOrMore>
        <element name="section">
            <attribute name="name"/>
            <element name="content">
                <zeroOrMore>
                    <choice>
                        <text />
                        <element name="p">
                            <empty />
                        </element>
                    </choice>
                </zeroOrMore>
            </element>
        </element>
    </oneOrMore>
</element>

That doesn't look so bad -- and since it's RELAX NG, and not W3C XML Schema, it's actually somewhat intuitive.

Now, check out the DSL:

default namespace = "http://galbraiths.org/myns"
element contents {
    element section {
        attribute name { text },
        element content {
            (text |
             element p { empty })*
        }
    }+
}

I think the XML version is clearly more intuitive for those with no previous exposure to RELAX NG, but for those who spend a lot of time working in the domain, my own experience (and anecdotal evidence) shows that the DSL is the clear favorite. By the way, the RELAX NG "DSL" is known as the "Compact Syntax". Until recently, I never thought of it as a DSL, but, it sure is.

So gosh, I guess I prefer domain-specific languages to general-purpose XML, too.

(I'll talk a bit about creating and using DSLs in Part 2 of this blog entry, and in Part 3 I'll give some examples of how Java's Swing GUI toolkit can benefit from a DSL or two.)





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds