Monday, May 16, 2011

Reflecting on my Google I/O 2011 Talk

This year was my first trip to Google I/O, both as an attendee and a speaker. The title of my talk was JavaScript Programming in the Large with Closure Tools. As I have spoken to more and more developers, I have come to appreciate how jQuery and Closure are good for different things, and that Closure's true strength is when working in large JavaScript codebases, particularly for SPAs. With the increased interest in HTML5 and offline applications, I believe that JavaScript codebases will continue to grow, and that Closure will become even more important as we move forward, which is why I was eager to deliver my talk at I/O.

Although it does not appear to be linked from the sessions page yet, the video of my I/O talk is available on YouTube. I have also made my slides available online, though I made a concerted effort to put less text on the slides than normal, so they may not make as much sense without the narration from my talk.

I was incredibly nervous, but I did watch all 57 minutes of the video to try to evaluate myself as a speaker. After observing myself, I'm actually quite happy with how things went! I was already aware that I sometimes list back and forth when speaking, and that's still a problem (fortunately, most of the video shows the slides, not me, so you may not be able to tell how bad my nervous habit is). My mumbling isn't as bad as it used to be (historically, I've been pretty bad about it during ordinary conversation, so mumbling during public speaking was far worse). It appears that when I'm diffident about what I'm saying (such as when I'm trying to make a joke that I'm not sure the audience will find funny), I often trail off at the end of the sentence, so I need to work on that. On the plus side, the word "like" appears to drop out of my vernacular when I step on a stage, and I knew my slides well enough that I was able to deliver all of the points I wanted to make without having to stare at them too much. (I never practiced the talk aloud before giving it—I only played through what I wanted to say in my head. I can't take myself seriously when I try to deliver my talk to myself in front of a mirror.)

If you pay attention during the talk, you'll notice that I switch slides using a real Nintendo controller. The week before, I was in Portland for JSConf, which had an 8-bit theme. There, I gave a talk on a novel use of the with keyword in JavaScript, but I never worked the 8-bit theme into my slides, so I decided to do so for Google I/O (you'll also note that Mario and Link make cameos in my I/O slides). Fortunately, I had messed around with my USB NES RetroPort before, so I already had some sample Java code to leverage—I ended up putting the whole NES navigation thing together the morning of my talk.

For my with talk the week before, I had already created my own presentation viewer in Closure/JavaScript so I could leverage things like prettify. In order to provide an API to the NES controller, I exported some JavaScript functions to navigate the presentation forward and backward (navPresoForward() and navPresoBack()). Then I embedded the URL to the presentation in an org.eclipse.swt.browser.Browser and used com.centralnexus.input.Joystick to process the input from the controller and convert right- and left-arrow presses into browser.execute("navPresoForward()") and browser.execute("navPresoBack()") calls in Java. (The one sticking point was discovering that joystick input had to be processed in a special thread scheduled by Display.asyncExec().) Maybe it wasn't as cool as Marcin Wichary's Power Glove during his and Ryan's talk, The Secrets of Google Pac-Man: A Game Show, but I thought theirs was the best talk of the entire conference, so they were tough to compete with.

Want to learn more about Closure? Pick up a copy of my new book, Closure: The Definitive Guide (O'Reilly), and learn how to build sophisticated web applications like Gmail and Google Maps!


  1. Michael,

    First of all, thanks for the great talk! I didn't get to see it in person, but I caught it on YouTube, and I'm glad I did: it was insightful and entertaining. I'm eager to start exploring where Closure can make our products better.

    Honestly, I thought your public speaking was excellent. Not too stiff, but not so informal that it was a constant string of "like, um..." and "so, yeah..." Good stuff.

    Anyways, thanks again. I look forward to seeing more of your talks in the future.


    P.S. - Loved the NES controller as well.

  2. This comment has been removed by the author.

  3. I felt you articulated yourself very well.
    Was a great introduction to Closure.

  4. Hi Michael,
    I enjoyed your talk and your book as well. I made me realize that Closure Compiler isn't just another minifier and Library must be understood in the context of compiler. Thanks.

    With regard to "with", I find it very interesting that I did a similar thing with "with" some time ago.

    In portal environments where multiple portlets want to use different JavaScript libraries or different versions of the same JavaScript libraries, you are very likely to run in to problems since almost all libraries (except later YUI versions) are designed to live in the global namespace.

    We created "VersionManager" which let people load several versions of the same JS lib on a page (in this case prototypejs is used as an example):

    with (VersionManager.version("1.6.1")) {
    //"1.6.1" refers to prototype which must have been loaded
    console.log("abcdaba".gsub("a","42"));// console.logs '42bcd42b42'
    console.log(typeof Object.extend);// console.logs 'function'
    });// console.logs '1','2','3'

    The interesting thing is that you created exactly what I needed back then: a JS to JS transformation making e.g, function f(){{} into var f = function(){}...

    I might just look at versions manager again using your compiler passes :)

  5. Hi Karl, that's a really great example of a clever and appropriate use of with -- if I ever give this talk again, I should use this as example!


  7. Content Writing: In the last few years, content marketing has quickly become one of the most popular fields in the digital marketing world.