Teaching the kids some programming

I don’t want to create a dynasty of coders, but I’d like to get rid of their blank look they get when I try to explain what the heck it is that I’m doing there. So since there was not much exciting to do today anyway I set up the laptops in the living room, and knocked on wood theat they wouldn’t find the experience boring and nerdy.

My kids are ten and eleven years old; my older son hasn’t shown any interest in computers apart from gaming yet; my younger daughter has lately been experimenting with typing stories into Word (OpenOffice Writer, to be precise), organizing music in iTunes, and manipulating photos.

I wanted something simple, quickly rewarding, and graphical for starters (to avoid the boring/nerdy impression mainly). I had seen KPL some time ago, but it’s been converted to/absorbed in a larger product called Phrogram: it’s commercial now, there seems to be quite a good community support, but I found it a little hard to find out where Phrogram starts and where it ends. What I miss on their website is a clear vision statement – it’s got 3D and database support, a debugger, testing… without having evaluated it too closely, I’d say it goes a lot further than being an absolute beginner’s tool.

Then there’s Scratch, which looks great for creating interactive media and things like point-and-click adventures. Scratch has got a graphic programming editor that lets you react to events, cause things to happen, and use structures like loops and forks (“when the kitten is clicked, play a ‘meow’ sound, for three times”).
Scratch looks like a lot of fun and surely supports getting wild with. The gallery of what people do with it is quite impressive. I’ll certainly give it a go later.

The thing I finally chose was a MS research project called Small Basic, which is specifically targeted to beginners. It features a highly simplified programming language, and a nice text editor that offers autocompletion and ad-hoc help. What I found striking about it is that it lets you use different types of programs: console apps, which are still great when you want to play with command-response style things (like a calculator); 2D vector drawing for cearting games and: The Turtle.

The Turtle offers a Logo-style programming model: There’s a turtle sitting in the middle of your screen; you can tell it to move, and to turn. While it moves, the turtle draws a line. You can’t have it any simpler. So here’s how to draw a rectangle:

Turtle.Move(100)
Turtle.TurnRight()

Turtle.Move(100)
Turtle.TurnRight()

Turtle.Move(100)
Turtle.TurnRight()

Turtle.Move(100)
Turtle.TurnRight()

In fact, that was the first thing I let my kids do, and they got it working within minutes, and were enthusiastic about the result (*phew*). Then I gave them a pencil-drawing of a more complex shape, and they got that working after some fiddling as well.

The Turtle draws a shape

Then they started making some own drawings (including an accidental swastika – by copy&pasting parts of the shape above) and were having fun. Soon there were complaints about the redundancy of typing in the same line of code several times (“can’t I just make it repeat this?”, typing “Turtle.DoItAgain()”). Time to move on: enter the for loop.

For howOften = 1 To 4  
  Turtle.Move(100)
  Turtle.TurnRight()
EndFor

wow! That went a lot better than I’d expected. Next time I’ll try to introduce variables to draw a spiral:

For howOften = 1 To 100
  howLong = howOften * 10
  Turtle.Move(howLong)
  Turtle.TurnRight()
EndFor

BTW, Small Basic compiles into “real” exe files that you can show off with, and can be converted to Visual Basic.

I’m quite confident that the first programming lesson was some fun, and sparked some interest.

Advertisements
About

Christian is a software architect/developer. He lives in Germany, reads a lot, and likes cycling.

Tagged with: ,
Posted in Coding
6 comments on “Teaching the kids some programming
  1. Jesper Stelter-Hogh says:

    D’awww! I wish I had kids right now…

  2. poisonbit says:

    D’awww! I wish I had kids right now…

    D’awww! I wish to be a kid now… 🙂

    Hey, reminds me of my first drawings with LOGO, in the era of 5 1/4 floppy’s (not sure if they were 286 or 386, I was 7 years old).

    I loved to draw cockpits of vehicles in LOGO.

    Now my niece of 10 years, runs Linux better than I did when I was 20. It is “the first operating system” for her, for me was the second, after years of Microsoft.

    Don’t you need to up/down the pencil ?

    🙂

    • Christian says:

      I’ll tell them about the up/down bit next time…

      my encounter with LOGO was in 7th grade in school, but that was two years after I severely had gotten into TurboPascal after a year of BASIC…

  3. Dudeson says:

    Nice!

    i wish i had learned programming much sooner! im 16 now..

    and btw, its called “Small basic” not “simple basic”^^

    about the exe files. yes, you can show them off to other people. theres just 1 problem. you need net.framework 3.5..

    • Christian says:

      You’re right, I’ve corrected that.

      Yep, the whole thing sits on top of .NET, and it’s also Windows-only. Which is probably OK for its current use case 😉

  4. Small Basic is nice, if you need a turtle for linux, try python or kturtle.
    Though none of the makes .exe-s. But you could use py2exe.
    I once tryied to show my brother programming the turtle (his 6) but he did not show much interest.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: