Welcome to our GSoC Students

Congratulations, and welcome to our Google Summer of Code students, who are about to start their summers working with Pencil Code. Each of the three students submitted and impressive proposal which earned them Google Summer of Code funding to support their work this summer making open-source technical contributions to Pencil Code.

It was a very competitive application process. This year, 37 applications for Pencil Code proposals were reviewed by a group of engineers and teachers working with Pencil Code, and three projects were ultimately chosen based on their anticipated educational impact and engineering feasibility. Funding from Google is incredibly generous, but still, there were many more impressive proposals than available funding slots.

The three Summer of Code students for Pencil Code in 2015 are:

Saksham Aggarwal - for a project to develop block-mode editors that will allow beginners to visually work with HTML and CSS syntax.

Liu Xinan - for a project to automatically create visual snapshots of student projects to allow students and teachers to more easily find and share their work.

Jeremy Ruten - for a project to help develop an improved visual debugger for Pencil Code, to help students understand their code by visually tracing execution.

This is an international group, and the students will work remotely from Singapore, India, and Canada.

All three of these projects are ambitious, but the students have put together impressive proposals on how they will tackle them this summer. We are looking forward to collaborating with this talented group. The goal is to create some significant educational improvements for Pencil Code by next fall.

The full list of Google Summer of Code program participants this year, across all the open source projects, can be found at the GSoC website, here.

Congratulations!

Thanks to Our Harvard Students

We just wrapped up our Citizen Schools class, and I would like to especially thank our volunteers from the Harvard Graduate School of Education: Cindy Yang and Ji-Sun Ham, and thanks to Karen Brennan for connecting us with them.

This Spring Cindy and Ji-Sun volunteered with Pencil Code to develop a terrific 10-lesson seqence to use with Citizen Schools after-school classrooms. Citizen Schools runs extended-day programs in low-income schools, where all the students participate in special "after-school" classes hosted by volunteers in the community. The kids arrive in these after-school classes with a wide variety of interests, motivations, and skills, so to meet the challenge of helping volunteer teachers run a highly differentiated classroom, Cindy and Ji-Sun came up with the idea of Pencil Cards - bite-sized activities on a card.

Teachers bring a pack of Pencil Cards to each class, and students can pick a few to experiment with. The idea is that the range of choice helps students find project ideas that are both inspiring and at the right level for themselves. The cards are small enough that motivated students can do a few in a class. And there are a progression of cards going through a number of topics in computational thinking. The idea is inspired by Scratch Cards, a simple starter tool for Scratch.

Here is an example card from our first-day deck:

The great thing about the Pencil Card project is that Cindy and Ji-sun developed it while testing it in two classrooms, taught by volunteer teachers, with middle- school students at Dorchester's Dever-McCormack public school. One classroom was taught by a group of volunteers from John Hancock: Latisha Silvera, Ramakrishna Arugollu, and Kevin Egan, who had never used Pencil Code before. The other classroom was taught by Google volunteers Yana Malysheva and Ethan Apter. Informed by their experiences in the classroom, our volunteers contributed several of the ideas for the cards (inluding Yana's very popular monkey, above.)

There are 10 weekly classes in a Citizen Schools class, and in the last three classes, the students learned HTML, and used that knowledge to develop online portfolios of their work.

At the end of the class, the students presented their portfolios at a fair that Citizen Schools calls the "Wow" event, attended by parents and many other adults and professionals from the community. It was incredible to see the students presenting and explaining their own work at the event. Suddenly, they were the experts in the room, explaining their technology and showing off their creative ideas to all the visiting professionals. We were all impressed, and I think we have several future software entrepreneurs in the making.

I have helped to teach with Pencil Code in Citizen Schools classes for several semesters, but this term was unique because of the Pencil Card format. The format allowed every student to develop a deep portfolio of individual work (as opposed to working only one team project), so every student was fully engaged, and every student wrote a lot of code. At the end, every student, regardless of level, was able to present and explain their own inventions.

Next, Citizen Schools will package the curriculum in a form that they can use with classrooms nationwide. They have scheduled that work this summer, for use nationwide in the fall!

Bravo, and thanks to Cindy and Ji-Sun, Citizen Schools, and the 2015 teachers and students in the DMC Pencil Code classrooms.

A draft of the Pencil Cards can be found here. Cindy and Ji-Sun have been thinking of running a kickstarter to pay for a run of professional printing of the cards. Let us know if you might be interested!

Pencil Code at SIGCSE

Just a quick note: Pencil Code will be presenting at the SIGCSE conference this week. Here is a link to the slide deck for the workshop we will present - it includes links to some curriculum materials that we are testing with Citizen Schools and with Google, and to some interesting, but preliminary, research results from pilot testing in classrooms.

Forever and Stop

Happy new year!

Here is a new year's resolution: by July 2015, we will freeze the Pencil Code interface so that we can build curriculum without worrying about removed features. So mail me any ideas of things that need to be changed in Pencil Code before then - info@pencilcode.net.

forever

The first change for 2015 is forever.

forever lets you repeat something indefinitely. Put an arrow -> after it, then indent code that you want to repeat.

forever ->  
  fd 2
  rt 2

It is useful for making animations. The previous version of this function was called tick. The difference is that forever lets you set up more than one loop to run at once:

forever ->
  fd 2
  rt 2

forever ->
  pen random color

The two processes run in parallel forever, so the pen continually changes color as the turtle moves.

stop() nothing is forever

Inside a forever loop, stop() will stop the repetitions. The following program will run the forever loop, watching for the w and down s keys on the keyboard. One of them will increase v and make the turtle move. The other will stop the forever loop.

v = 0
forever ->
  fd v
  if pressed 'w'
    v = v + 0.1
  if pressed 's'
    stop()

forever loops are different from for and while loops. forever is a function whose loops are stopped by calling the function stop().

for and while are loops that are built-in to the language. To stop those loops, use the built-in command break.

The speed of forever

The forever function can be set to repeat at any number of repetitions per second. Just add an optional number before the arrow:

forever 1, ->
  dot random color
  rt 30
  fd 25

The number is the number of repetitions per second.

Variables in Code

Variables are so fundamental to programming that it is easy for an experienced programmer to forget what it means to learn about them for the first time.

An easy one

This program is easy for a beginner who has learned that * is multiplication:

x = 15
write x * x

Clearly the first line says x stands for 15, so the second line writes 15 * 15, which is 225.

A hard one

On the other hand, a typical beginner cannot predict that this program writes only perfect squares, (even after they have learned that random [1..10] makes a random number from 1 to 10).

x = random [1..10]
write x * x

What is the trick here?

Definitions versus memory

In code, the assignment x = value represents storing a value in memory.

But if you have never written a program before, your experience is that variables are used for definitions, not memory. When variables are used in algebra, the statement x = y + 1 represents a permanent timeless definition. Therefore you might read our program like this:

  1. Define x to mean random [1..10] everywhere. (wrong)
  2. Now write x * x means write (random [1..10]) * (random [1..10]).
  3. So it might randomly write something like 3×7 = 21. (nope)

This is the wrong mental model in most modern programming languages. Here is the way to think about it:

  1. Calculate random [1..10] and store the answer in memory as x. (right)
  2. Now write x * x means to look up the stored value of x each time it is needed.
  3. So it might randomly write something like 8×8 = 64. (yes!)

Variables are different in code and algebra. Variables in code represent a piece of memory.

Key concepts

  • A variable is name for a piece of memory.
  • A program is run in order from top to bottom.
  • Assignments x = value store a value in memory.
  • Referring to a variable looks up the value in memory.