U.S. Markets closed

PM Justin Trudeau's Hour of Code

Hadi Partovi

Originally published by Hadi Partovi on LinkedIn: PM Justin Trudeau's Hour of Code

I had the unique opportunity to arrange for Canada’s Prime Minister Justin Trudeau to officially kick-off the 2016 global Hour of Code campaign. A few friends asked me to share the story, so I figured I’d write it up.

How did it get set up in the first place? The old-fashioned way: by asking anybody I knew if they knew anybody with a connection to the Prime Minister’s office. Every high-profile engagement we set up takes months or even years to make happen. I’m still working on Pope Francis, for example. :-)

The event was a wonderful collaboration with the Prime Minister's office, Melissa Sariffodeen of Canada Learning Code, and the team at Shopify who hosted the event at their Ottawa headquarters.

When Prime Minister Trudeau arrived, Melissa and I went to greet him and prepare him briefly for the event. The first thing he asked was: "Am I going to need to brush up my C++ skills for this? Or will it be more like Lightbot?" I already knew the Prime Minister was a geek at heart, because he had briefly studied engineering in college. But I didn't realize he had programmed in C++ already, nor that he knew about Lightbot, a coding app for young pre-readers designed by a Canadian entrepreneur.

After a few comments by the adults, I introduced the Prime Minister who spoke briefly about the importance of learning computer science. He emphasized that computer science is just as relevant as any other field of study, and about the careers in the space.

But unlike other politicians – who haven't had much direct experience in coding – it was different to hear him talk about what you can learn from computer science. For example, he explained that even if you don't go on to be a coder, computer programming can teach you how to take a really large problem and break it down into smaller parts. He added that even if you don't get a career in computing, learning how technology works will be useful for future doctors, lawyers, bankers, or really any career. These are talking points that anybody can memorize, but they’re more authentic when spoken from somebody who has spent any time studying engineering.

Next I introduced the PM to Matthew, a young student who was ready to work together on the new sports-themed coding activity by Code.org. For this year's Hour of Code we had developed a theme around athletes –including an inspirational video featuring Serena Williams, Neymar, Kobe Bryant, and Carmelo Anthony – and so the sports-themed coding activity was a companion to this.

My plan had been for Matthew to show the PM exactly what to click and what to do, so there wouldn’t be any mistakes, because his screen was projected on a large display for all to see. But the PM very quickly figured it out on his own and started adding the blocks of code on his own. Soon after the event started, I used Facebook Live to get some live video coverage of the event, and I briefly asked the PM to explain for the live audience what was happening. What was pretty funny about this is that even though he spoke for the camera, it was pretty clear the PM wanted to get back to his coding. He was clearly "in the zone."

The coding activity by Code.org lets you gradually piece together a sports-themed game inspired by the original Atari game Pong. The drag-and-drop coding lets you attach commands to event-handlers, to put together the user interface that decides what actions should happen during the game, and when.

Prime Minister Trudeau quickly put together the "default" game that the coding activity leads you to create, which involves moving a paddle around to bounce a ball into a goal. He then chose to make his game hockey themed. However, he then wanted to see whether he could "break the rules", so he added code so that every time you miss the hockey puck, not only you lose a point, but an extra puck is added into the game. The more you miss, the more pucks you need to play with, which quite quickly gets out of control. The PM posted his app on Facebook, and commenters quickly complained about the "bug" in the code, not knowing that he had written the code intentionally just to make it more interesting.

The PM took a brief picture with matthew to celebrate his "Certificate of completion" for the Hour of Code, and then sat with other students who had moved on to try other activities such as the Minecraft Designer or the new Moana tutorial by Disney.

He then came to me and began praising Code.org effusively for the quality of our tutorials. He said "the way Code.org presents computer programming is great! You've really made it wonderful for these kids - the graphics, the drag and drop interface. I have to start doing this with my children."

It was already awesome to have introduced the Prime Minister, and for him to compliment our work. But what happened next was my most personal memory of the event. I told him that our drag-and-drop interface had another benefit: we could translate the activity into different languages, for students who don't speak English, such as the French canadians in the classroom. And I said there was actually a young girl here who had just moved to Canada from Syria. She couldn't read English or French, and she thought she'd never learn to code, but because Code.org can switch to almost any language, she joined the other kids while learning to code in Arabic.

The Prime Minister asked: "Which one is she?" and I pointed him to a young girl named Fatima. He immediately went to her and kneeled next to her, asked if she's having a good time, and thanked her family for coming to Canada.  This wasn't a publicity stunt, and their interaction wasn't being filmed.  As an Iranian-American, I remembered how difficult it had been to enter the United States in the 1980s right after the Iranian hostage crisis, so I quickly pulled out my phone to capture a photo of the moment.

After talking to Fatima, the Prime Minister took a few selfies with the students, returned to thank me and Melissa Sariffodeen for organizing the event, and left. As a kick-off event for the 2016 Hour of Code campaign, we couldn't have been more pleased.

Hadi Partovi, Code.org

P.S. Below is the simple block-based code that the Prime Minister created: