December 08, 2013

Hour of Code at AMSA

Families participating in the AMSA Hour of Code 2013.

Yesterday I participated in a wonderful Hour of Code event at AMSA. The AMSA and Marlboro teachers there are absolutely amazing, dynamic teachers. I brought some new Pencil Code materials and books to use. Within 15 minutes they had things copied and stapled together; they had reviewed the new materials; and they were ready to roll.

Here are the materials we used yesterday.

Attendance was terrific, overflowing the reserved classroom. So they opened up a second classroom and divided kids by level. The higher level kids went through "Lesson 3", which covers topics such as variables, control flow, arrays, randomness, synchronization, and network requests.

The beginner kids started with "Lesson 1", which gets you going with basic sequencing and turtle drawing. At the 30 minute point, they were doing well, so I showed them the video for "Lesson 2", which is a nudge to get you to be thoughtful and creative. Lesson 2 also demonstrates arcs, which are a great tool for students to use to make beautiful things.

A few creations from the rank beginner kids - a lot of understanding in just one hour!

Posted by David at 11:35 PM | Comments (0)

December 09, 2013

Hour of Code at Lincoln

Lincoln classrooms participating in the Hour of Code 2013.

Today I spent the day at Lincoln public school, helping grade school classes participating in the Hour of Code. We were hosted by teachers Cindy Matthes and Terry Green, who both have a long history of championing technology education for young kids. Terry literally wrote the book on teaching engineering to K-2 kids.

Here are some of the fourth-grade creations - as you can see, at this level, coding is mostly about learning about quantities and careful sequencing.

Several of the fourth grade girls were the natural leaders their Hour of Code classes: they had a ton of ideas of what they wanted to draw. They wanted to know how to get the colors they wanted, how to draw curves, how to draw text, and how to make the turtle wear a different colored shell. There were very few preconceptions about what they could or could not do with a computer at that age, and they were persistent in getting things to work.

The middle-school group was self-selected (and, in an odd contrast with the experience in the fourth grade group, they were mostly boys). They were able to speed through Lesson 1 at event.pencilcode.net in 30 minutes, and we did a bit of Lesson 2 as well. In middle school, there is a pretty broad spectrum of styles - some kids wanted to try small experiments of their own invention, and other kids wanted to type in a complicated ambitious program from the book to see if they could get it to work. The book of 100 example projects was a useful tool for this older group. Continue reading "Hour of Code at Lincoln"

Posted by David at 05:32 PM | Comments (0)

December 16, 2013

Teaching Math Through Pencil Code

How young is too young to teach programming?

I have been using Pencil Code with children from 1st grade to 12th grade over the last few weeks. All ages have a lot in common: they all need to learn the same programming concepts at the beginning. Even before learning control flow, they need to understand sequencing, debugging, and how to think about the state of the computer. However, there is one big difference between younger kids and older kids: the younger kids have not yet learned a lot of math fundamentals.

Using Programming to Reinforce Math Curriculum

When a fourth grader asks "what is the command to make the turtle go that way?" it is really a math question. The idea of estimating degrees for a turn seems perfectly concrete to an older student, but if you are a 4th grader, measurement of angles is a new idea that is hard to grasp. The fourth grader wrestling with the turtle's direction is really asking, "how do I measure the angle that I want?"

The problem of getting the turtle to turn the right way is a valuable math teaching moment. Do not give away the answer. Instead, give the student a protractor, and the student will align it with the turtle on the screen and pick out the angle they want.

Pointing the turtle requires an extra level of care beyond math class, because the student will need to note not only the degrees, but also whether they want a "right turn" or "left turn." But once the proper angle is found and the student has entered "rt 60," they they are rewarded with a working program as well as an insight: angle measurements are pretty useful!

When teaching classrooms of fourth graders, I have been using handouts with paper "turtle protractors" that illustrate the turtle in the middle of a compass rose. The printable measurement sheet also includes a "turtle number line" so that younger kids can do the same exercise with linear measurements. These paper supplements are invaluable.

Programming Motivates a Range of Math Curriculum

Computers speak the language of math, so learning to program your computer is a good reason to learn a bit of math.

Math topics that tie directly in with Pencil Code include:

Programming is a good way to learn about to the importance of precision in measurements and the use of numbers to quantify many things. Normally this is hard-won knowledge, gained through years of teachers marking mistakes on math homework. But in programming, the purpose of math is not to get a good score on a test. The purpose of the math is to get your program to work. It is a self-teaching lesson.

Programming Motivates Advanced Concepts

Programming draws kids in to playing with concepts that would normally be considered too abstract and dry for math class.

For example, kids particularly love creating programs that draw circles and curves. However, since arc measurements are (sadly) considered an advanced High School concept, they will not have been covered before most beginning programmers try Pencil Code.

With Pencil Code we have been introducing arcs using an arc-measurement sheet that is similar to the protractor sheet. Kids can hold it up to the screen it to visualize (for example) the fact that the bottom of a "U" is 180 degrees of an arc of a circle. Fourth graders enjoy measuring arcs as part of their programs: arcs make it possible to create beautiful flowers and sports cars and inscriptions.

Perhaps when these Pencil Code fourth graders arrive in high school geometry class years from now, arc measurements will be less of a mystery and more of a "cool" topic.

Posted by David at 03:37 PM | Comments (0)

December 18, 2013

Learning to Program with CoffeeScript

Is CoffeeScript a good first programming language to learn?

Absolutely!

I have written a new tutorial for beginners to learn to program with CoffeeScript.

Like Python, CoffeeScript has a punctuation-light syntax that is easy to type so that beginners can get straight to the essential concepts instead of fiddling with semicolons and matching curly braces. And yet it is a real language used by pros, so you can learn the essential concepts that you will see in other languages: variables, algebraic expressions, control flow, functions, lists, objects, classes, closures, exceptions, and (if you use Iced) even continuations.

The big advantage of learning CoffeeScript over Python is that you can start right now in your browser, without installing anything! Although CoffeeScript doesn't have the same full-featured standard library that Python has, jQuery makes a fine standard library. To help beginners, I have put together jQuery, a turtle graphics plugin jQuery-turtle, and a syntax coloring editor on pencilcode.net.

The tutorial teaches you how to program in CoffeeScript by building a game of hangman from scratch. It takes a couple hours to learn enough programming to make hangman. You will learn about:

  • Memory and naming
  • Computer arithmetic
  • Using functions
  • Simple graphics
  • How to make a program
  • Input and output
  • Loops and choices
  • Delays and synchronization
  • Connecting to the internet

At the end we will have a game we can play.

Here is the tutorial: Learning to Program with CoffeeScript.

Posted by David at 10:30 AM | Comments (0)

December 20, 2013

Second Edition of Pencil Code

The best parenting advice: before your children grow up, teach them something. They will remember it forever.

So in that spirit, here is an activity to do with your daughter or son over the holidays: give and play with the second edition of Pencil Code (just released). Teach them how to write little computer programs.

The new edition adds a 20 page appendix with a CoffeeScript tutorial, which is particularly helpful if Mom and Dad do not create software for a living. If you already got the first edition and you wish you had the tutorial, do not worry - get the tutorial on the web here and print it.

While you are playing with Pencil Code, also be sure to look at the extra free materials on guide.pencilcode.net - there are handy printable protractors, reference sheets, activities, and videos. And almost all the material in the book is available online for free. If you do not want to use paper, you can just go to pencilcode.net and play for free.

Still, the book makes a terrific present. Children show their incredible sense of wonder when leafing through a little handbook of examples of magical code, each one illustrated in color. Each page is a map to a little adventure, a puzzle and a discovery waiting to unfold.

The book has more than 100 little programming projects, and they range in depth and ability from 1st grade up to 12th grade. The first page hows how to make a webpage that draws a simple line. The last one shows how to make an artificial intelligence that will beat you at tic-tac-toe. In between, draw a flower, make a game of tag, or draw the Mandelbrot set.

It is a little book crammed with ideas, designed to last for a decade. As long as it is in your house, it is a reminder: there is something much cooler than playing computer games: making your own.

(Also, while you're getting the book - Amazon didn't bring the reviews of the first edition along to the second edition, so leave a nice review!)

Posted by David at 12:22 PM | Comments (0)