Saturday, October 20, 2012

"Daddy is a Robot" on Ada Lovelace Day

Tuesday this week was Ada Lovelace Day, an annual celebration of the women in science, math, technology, and engineering who have inspired us to become who we are today.

Ada Lovelace Day is doubly important to me: in Grade 3—when I was 8 or 9—the person who introduced me to computer programming was a smart, supportive, and encouraging woman named Lise; now I have a six-year-old daughter named Ada who is smart as a whip, kind and thoughtful, and full of creativity. Lise engendered in me a lifelong joy of programming by teaching me Logo and BASIC on an Apple ][; naturally, I've been eager to give Ada the same chance by teaching her Logo.

But not on an Apple ][. Not on an electronic computer at all. Not just yet. Instead, we've been playing the "Daddy is a Robot Game."

The setup is simple: I used index cards, some sticky labels, a pen, and a pencil. I cut up the labels into small rectangles and wrote the basic Logo commands on them in pen, like this:

Note the blank space to the right of the commands. That's where the programmer writes in the parameter. I gave Ada a pencil with an eraser for this, which helped a lot when it came time to fine-tune and debug the program.

To get things started, I put a few simple commands (FD 2 RT 90 FD 2) on a card. I gave this card to Ada. I explained that when I was a robot, I would follow the instructions on any card that someone hands me. So I became a robot, Ada handed me the card, and I followed the instructions. I ended up running into a wall. Ada was hooked immediately!

Coming up with inspiration for a program turned out not to be a problem. On her own, Ada quickly decided to try and get me to go upstairs.

We designated a place on the floor as "home," and Ada made a card that had just the HOME command on it. At first, she would hand it to me before each run through her program. Then, to make things efficient, she wrote HOME on the back of her program card, then she invented the TURN command, which told me to flip the card over and run the program on the other side. How quickly programmers want to become language designers!

Giving the arguments to LT and RT in degrees was not a problem. Ada is in first grade now, and although she's not completely comfortable with "big" numbers, it was a comfortable stretch for her. She had no trouble remembering 90 degrees is a right angle and 180 degrees reverses course.

But from my point of view, the most amazing part was to watch Ada debug the program. It came naturally to Ada to sit at the table and visualize herself moving through the program as me. She would locate the instruction that caused me to overshoot or undershoot a turn—or run into something—and then erase the number and write in a different one.

Taking this exercise to the computer will be a small step: we're already using real Logo syntax, and we're working with the concept of starting over with a blank slate in the home position (in Logo, you do this with the DRAW command).

I have no idea what Ada will want to do when she grows up. Veterinarian, Astronaut, and Drummer are all on the list. I wouldn't be surprised if she adds Computer Programmer after we take this game onto the computer. Whatever she chooses to do, I think that it can only help that she's making the neural connections now that will give her an intuitive understanding of what it means to program a computer.

If you're a mom or a dad, a teacher, or an uncle or an aunt, why not try this with the 5- and 6-year-olds (or older) in your life? It uses simple supplies you probably have in a desk drawer already, it takes minutes to get started, and it just might lead to a lifetime of fun.

Wednesday, October 10, 2012

JavaOne 2012 Retrospective

I think I can best summarize my experience at this year's JavaOne in just two words: It's Back!

After some well documented missteps which I witnessed first-hand in 2010, I can confidently say that that JavaOne conference has completely recovered from the change of venue and it once again feels like a first-class conference. The organization was spot-on, and the content selection was superb. A big thank-you to the organizers who worked tirelessly, listened to our feedback, and made JavaOne 2012 the year to beat!

My highlights this year started with the Java Community sessions on Sunday. This is a tradition that started in 2009 with the Sun Community Days conference, a free conference for community projects that took place at Moscone on the Sunday before JavaOne. It was nice to share information on the different techniques for getting people engaged in the Adopt a JSR and Adopt OpenJDK initiatives. This is something we are trying to get more involved in at the Toronto JUG. The outcome for me is that we plan to hold a hack night in Toronto where we will focus on getting a preview implementation for one JSR up and running on everyone's machine, then we'll try coding something against it so we can provide feedback to the expert group. Of particular interest are the JSON processing API and the new Date & Time API. If there is a JUG in your area, you should do this too! Now that JSRs are developed in the open, you are partly responsible for the APIs. There's no excuse to stay uninvolved!

After the community events came the Sunday evening keynotes. For me, the standout was the Java Technical keynote.

Rather than a boring list of features and roadmaps, the technical keynote was structured as a conversation between Brian Goetz and Mark Reinhold that arose from a code example from the previous segment (which was on JavaFX). Brian bemoaned the "beef to bun ratio" in the example and used it as a vehicle to demonstrate the language and library changes that are coming in Java 8 as part of Project Lambda. It was entertaining and informative: the most fun I've had at a technical keynote in quite some time!

Another highlight at the technical keynote was seeing OpenJDK and JavaFX running on ARM. We saw OpenJDK running on two different ARM systems, one of which was (of course) a Raspberry Pi. Cool stuff: in terms of development tools and deployment stack, embedded computing is now virtually indistinguishable from desktop computing. Or server-side computing, as several people showed earlier this year.

In Monday's sessions, I learned an interesting tidbit: did you know that the Jackson Java-JSON marshalling system not only outperforms the other established JSON marshallers within the JVM, but it actually gives Protobuf/Protostuff and Thrift a run for their money. I wonder how it stacks up against the generated JSON marshallers we use with Errai (the project I work on at JBoss). There's something new for my to-do list!

Monday afternoon (in fact, every afternoon), we had the opportunity to sit outside in the beautiful Taylor Street Café and enjoy some free beer and coffee from the "Buzz House" bar.

This was the best way I found to meet new people and have a chat. One of my most memorable chance encounters was with someone from the team that builds the app that science teams use to apply for time on the Hubble Space Telescope. His team also maintains the software that actually executes the repositioning commands and moves the telescope up in orbit. His team is really excited about the James Webb Space Telescope, a much larger instrument that will launch in 2018, achieving an even clearer view by orbiting near the Earth-Sun L2 Lagrange Point (between the orbital paths of Earth and Mars). One of its design goals is to get a good look at planetary systems other than our own. Exciting times ahead!

Monday night, we were off to the official unofficial Java Posse hangout at Kate O'Brien's. We had a nice chat with the Posse and the other listeners who showed up.

On Tuesday, I teamed up with Christian Sadilek to co-present at the JBoss booth in the exhibition hall. First, we did a live-coding presentation where we had some fun with Errai, hooking up accelerometers to CDI events using the HTML5 device orientation API, then visualizing the data with CSS3 perspective transforms. In our demo, we even streamed these events to the server and rebroadcast them back to clients for a social "tilt party" effect. [will edit with a link to the video once it's available.]

Tuesday evening, I attended the BOF that's a perennial favourite of mine: "Java Champions and JUG Leaders meet the SunOracle Executives."

In this evening session, top executives from Sun (and now Oracle) submit themselves to some tough questions from JUG leaders and Java Champions. I really appreciate these guys putting themselves in the hot seat and not just defending past missteps but listening to us and putting forward suggestions on how to make things better. This year's execs were Henrik Stahl and Georges Saab. They did a good job maintaining the honesty and earnestness I've come to expect from this session. Henrik even closed by asking for this to be a 2-hour session next year. Right on!

On Wednesday, Christian and I were back in the JBoss booth with more live coding, this time showing Errai's typesafe JAX-RS client and our browser-based JPA implementation that persists and retrieves JPA entities in HTML5's localStorage. [again, a link to the video is coming.]

Incidentally, on Wednesday I had the opportunity to tell Linda DiMichiel, JPA spec lead, about my efforts implementing JPA2 in the browser. She literally laughed out loud. I'm choosing to take that as a compliment. :-)

On Thursday, Christian and I presented our technical session. In that session, which we lovingly called Taming the Spaghetti: Rich Web Applications in Errai, we discussed the motivations for designing web apps to run large portions of their code in the browser; we talked about why it's a big help when the browser-side code and the server-side code are written in the same language, and we made our case for doing that in Java with the help of the GWT compiler. Then we showed how the Errai framework makes everything better by reducing boilerplate, promoting a declarative code style, and allowing maximum sharing of code between client and server. Then we dove into the specific features and demoed them with some live coding.

In my not-so-humble opinion, our talk hit the right balance between well-paced, informative, and funny. And thanks to the JavaOne team, that talk is already available online for everyone to stream for free. Check it out now! (The link for streaming is under Media on the right-hand side.)

All in all, it was a great JavaOne: I met new people, chatted with those I met in previous years, and got lots of time with my out-of-town JBoss colleagues. Plus the presentations I was involved in went really well. Thanks to all who attended!