MIOsoft logo

Snap: Programming for everyone

Erin Kapp

Tell me if this sounds familiar: You took a class in high school or college because you had to. Or because your first choice class was already full. Or because your crush was taking it.

But then that class changed your life. Maybe in a small way, where you’re interested in that subject as a hobby now, and maybe in a big way, where that subject is your career now.

A typical introduction-to-programming class doesn’t really lend itself to this kind of transformative experience. Not that it’s never happened; I’m sure it has. But even the very first introductory course, the elective one for non-majors, tends to start you out with a blank screen and a blinking cursor.

This is the kind of class that attracts students who actively want to take it: students who are already interested in programming. So new students with no prior programming experience are behind their peers from day one—and since most classes don’t move at the pace of the least knowledgeable student, they end up more likely to struggle with or drop out of the course.

The thing is, the students who are succeeding with this approach to computer science education are primarily white and Asian men [PDF]. No other demographic is even close.

So how do we set up students from underrepresented demographics for success? This brings me to Snap, a programming language that challenges the status quo:

Accessibility: Snap is a visual block language, making a student’s first experiences with computer programming a lot more interactive—and interesting—than traditional opening exercises like print ‘Hello World’. But Snap is also a serious language that includes advanced concepts like recursion, higher-order functions, first-class lists, and continuations, so it can be used up to the early college level.

Availability: One of the barriers to wider CS education is that not every K-12 student has access to the appropriate technology to program. Snap is written entirely in JavaScript, so it’s completely browser-based and doesn’t require downloads. This makes Snap very widely available, since browsers are preinstalled on virtually every computer and mobile device.

Education: Snap is the programming language for UC Berkeley’s Beauty and Joy of Computing curriculum (BJC), which aims to bring introductory CS to a wider range of students than the typical intro to programming does. BJC is also used at the high school level, and is a curriculum for the new AP Computer Science: Principles test.

With these three crucial components, Snap is taking off. Over 127,000 project updates were made in Snap last month, and Snap is a key component of the new four-year, $5.4-million NSF grant to bring more computer science to NYC public high schools.

But that’s a lot to take in, so I’ll start again. At the beginning this time.

Backstory

Snap exists because of Scratch, which is a project of MIT’s Lifelong Kindergarten Group. Scratch is a block-based language, aimed primarily at elementary-to-middle school students, but it has a vibrant community of programmers of all ages.

While Scratch could (and can) do a lot, there were some key computer science concepts that it didn’t include. Brian Harvey, a Senior Lecturer SOE at UC Berkeley, had been sold on Scratch by its community, but wanted it to do more. At a 2008 Scratch conference, Harvey organized a session about why Scratch should be able to define procedures.

Jens Mönig, a part-time Scratch developer (and soon-to-be full-time MIOsoft developer), was at Harvey’s session, and discussed it with other members of the Scratch team. Mönig soon decided to see if Harvey’s idea was even possible—and when it turned out that he could indeed create a Scratch modification that would allow you to build your own blocks, he naturally called his prototype BYOB.

Around the same time, Harvey and his colleague Dan Garcia were developing a computer science course to attract students who weren’t being drawn in by the existing courses, especially women and underrepresented minorities. They piloted the first version of the course in 2009, using Scratch, but Garcia asked Mönig if they could use BYOB—and its extended features—as the course language going forward.

Of course, Mönig said. Mönig, Harvey, and Garcia began to collaborate, with Mönig developing BYOB even further as Harvey and Garcia worked on their course. BYOB, although still retrofitted to the Scratch source code it has originated from, was now verging on becoming its own programming language.

But by 2010, Mönig’s contract with MIT was up. The Scratch team had ultimately decided not to include BYOB’s features in Scratch, and Mönig wasn’t interested in working on the effort to rewrite Scratch in Flash ActionScript. Instead, he decided to reimplement the BYOB code, eventually settling on JavaScript.

Harvey and Garcia, meanwhile, were thinking about how to adapt their new course—Beauty and Joy of Computing—to the high school level, especially with the new AP Computer Science: Principles exam on the horizon.

A few high school teachers believed that some parents might object to the alcohol-related connotation of the BYOB name, Mönig’s arguments that BYOB actually implies the absence of alcohol notwithstanding.

So in the interests of making it as easy as possible to get BYOB into schools, BYOB 4.0 made its 2012 debut under the name Snap.

Accessibility

Snap is a block-based language aimed at the high school to early college level. Although its friendly, colorful aesthetic is meant to attract skeptical students, its visual approach also makes traditionally complex concepts, like lambda, accessible in an intuitive way:

Lambda in Snap

Students can also benefit from one of Snap’s most technically interesting features: the integration of its program execution with the development environment.

A Snap program can be paused and restarted at will, but more significantly, it can be changed while running and the change will take effect, providing students with an immediate feedback loop. This is enhanced by a glow effect which highlights the script that’s currently running.

It’s pretty clear how beneficial this can be for students struggling with problems ranging from “the math is wrong... somewhere” to “accidental infinite loop.”

Availability

Mönig, Snap’s lead developer, was at MIOsoft for most of Snap’s early years: he started here in 2009 and left in 2013. So in late 2012, when Snap needed a back end to let users save projects to the cloud, it was natural for Mönig to discuss the problem with his MIOsoft colleagues.

Making introductory programming more available to more people is a goal we here at MIOsoft can get behind. So MIOsoft donated a MIOedge-supported back-end application and hosting to Snap, including project and media management. Snap users can now (optionally) save projects to the cloud and (optionally) share them publicly. Snap users can also save locally or stick to single-session projects that they don’t save at all.

The MIOsoft-supported Snap cloud has been running since February of 2013. And while I could just tell you that we’ve seen enormous growth and Snap is reaching people worldwide, I decided to put up some numbers instead (we are, after all, really into data here).

It’s worth noting that our numbers only include projects saved to the Snap cloud. We don’t have a way to count Snap projects that are saved locally or not saved at all.

To describe Snap’s reach, we looked at the cloud updates for January of 2015 and based our country-of-user on the IP the update came from. Each update is one Save or Save As of a project.

Here’s our map, with Snap-using countries in blue:

Map created using the amcharts.com Visited Countries map. Click to open the complete map.

Map created using the amcharts.com Visited Countries map. Click here to open the complete map.

There were a total of 127,383 updates last month. 90.1% of those updates were from the United States, with an additional 5.7% from unknown locations. The 5,116 non-US, known updates came from 46 different countries.

Here are the complete numbers:

114725 United States

7542 Unknown

1872 United Kingdom

1179 Italy

357 Germany

190 France

152 Guatemala

116 Thailand

116 Turkey

104 New Zealand

103 Mexico

100 China

89 Portugal

68 Spain

61 Canada

58 Puerto Rico

57 Austria

56 Finland

51 India

39 Greece

37 Israel

36 Australia

34 Brazil

34 Poland

33 Czech Republic

28 Switzerland

25 South Africa

24 Russian Federation

14 Denmark

10 Ireland

10 Sweden

10 United Arab Emirates

8 Hong Kong

8 Japan

8 Netherlands

6 Panama

5 Slovenia

4 Republic of Korea

3 Bangladesh

2 Romania

2 Viet Nam

1 Colombia

1 Costa Rica

1 Hungary

1 Latvia

1 Malaysia

1 Singapore

1 Taiwan; Republic of China (ROC)

So a lot of the territory in our map is probably due to only a few people per country. In several cases, it’s just one person—but we’ll take it. One is still better than zero, and we hope that they tell all their friends how much fun they’re having with Snap.

To quantify Snap’s growth, we decided to look at update timestamps for cloud projects: specifically, the timestamp of each project’s most recent edit. We considered the month of a project’s most recent edit to be the month when the project was finished.

This isn’t a perfect metric, but it’s enough to give an idea of the amount of activity in Snap on a month-to-month basis. Projects last updated this month—in February—aren’t included here.

Here’s what we found:

Snap cloud finished projects by month

Snap cloud finished projects by month

We’ve clearly seen a significant increase in Snap activity: 2013’s high was October, with 6,985 finished projects, while 2014’s was September, with 26,905 projects. And although the 2014 peak has fallen off in the last few months, January 2015 still had about twice as many projects as the 2013 peak.

Since Snap is used in college and high school classes, it’s also interesting to look at this graph and consider whether the academic year has any impact:

Snap cloud finished projects by month with semesters marked

Snap cloud finished projects by month with semesters marked

The fall 2013 semester was the first semester to use the MIOsoft-hosted Snap instead of BYOB in Berkeley’s BJC course, so we weren’t surprised that that’s when the number of finished projects suddenly picked up.

But although BJC is one of Snap’s most visible uses, it’s certainly not the only one, and it would be a mistake to attribute all of Snap’s activity patterns to Berkeley. Snap supports a wide base of users, including individuals working on their own projects and teachers using Snap for non-CS subjects or with other CS curricula.

While it would be interesting to see numbers for this, Snap doesn’t collect personal information, so all we can do is speculate: Harvey estimated that no more than half of Snap’s users can be attributed to BJC.

Education

I haven’t talked about the Beauty and Joy of Computing curriculum in detail, but if you’re at all interested in introductory computer science education you should check it out. It’s offered routinely at Berkeley as CS10, and work on it has been supported by several National Science Foundation grants.

The latest of these NSF grants will bring BJC (and therefore Snap) to New York City public high schools. The four-year, $5.4-million grant will fund several initiatives at the high school level, including the creation of a new K-12-specific BJC curriculum package and training for 100 high school teachers.

Specifically, BJC will be used as the curriculum for the new AP Computer Science: Principles class in NYC public high schools.

The new AP CS: Principles course is meant to attract a broader range of students than the existing AP Computer Science A course is getting. Although AP CS: Principles includes a programming component, the curriculum doesn’t specify a required language, so Snap can be used.

For teachers working in schools with restrictive IT policies, using Snap—which doesn’t need to install anything—may be what allows them to offer the course. And for students with limited access to computers outside of school, using Snap may—for the same reason—be what allows them to take the course.

Or so we hope, because that would be one indicator that Snap+BJC is helping to bring programming to K-12 students who currently don’t have access.

We don’t have enough data points yet to make any definite pronouncements about whether Snap is helping to change the face of computer science education. We’re still at the anecdotal data stage.

We’re optimistic though, because they’re promising anecdotes.

Berkeley’s CS10 course has seen increasing enrollment and higher performance by women compared to the course it replaced (CS3, which used Scheme). In 2014, for what is probably the first time ever in CS10 /CS3, CS10 enrolled more women than men. And Harvey has observed that students using Snap are having an easier time understanding some of CS’s complex topics than they did when introduced to those same topics using Scheme.

Piedmont High School in Piedmont, CA, uses BJC as its introductory computing course. Since they began using the BJC curriculum, they’ve doubled the number of students in the course and increased the participation and retention of girls in computer science classes. Watch an interview with PHS computer science teacher Nathan Mattix:

Josh Paley, a teacher at Gunn High School in Palo Alto, CA, uses Snap and BJC to successfully meet the needs of programming students of all levels:

Even so, challenges remain. Harvey pointed out that the high schools using BJC have so far been public schools in relatively wealthy areas and charter or private schools. At Berkeley itself, students who are underrepresented minorities in CS are also underrepresented in the student body.

The BJC in NYC project will serve a much more diverse student population: in the NYC public school system, more than 60% of students are black or Hispanic, and more than 75% of students are eligible for free or reduced lunches. So although BJC has had early success, part of the project will involve working with the project advisory board’s equity and inclusion experts to bring that success to a broader student population.

Try it

Of course, to write about Snap, I had to try it out myself. Click here to open my first Snap project, Curling Score, which lets you click and drag the curling stones onto the house and then scores the end:

Click here to open Curling Score!

Click here to open Curling Score!

Or click here to run Snap and begin working on your own project right away.