Spot any errors? let me know, but Unleash your pedant politely please.

Saturday 14 March 2009

Scratch from MIT

My son, who is in year 6, has expressed some interest in programming (like lots of kids, he wants to be a games designer). I tried getting him interested by introducing him to Python. I thought he could get used to the language and OOP, without getting heavy with strong typing, verbose, unclear languages. Python gives fairly quick results (faster, probably if you don't use is like an Ada jockey who knows a bit of Java)

I'd looked very briefly at PyGame, and figured that it would be relatively easy to pick up.

Last week though, I followed a link to scratch, and it was very obvious that this was the place to start. I think I was right. I showed it to my son this morning, and with a little guidance, he finished writing a version of Pong today.

There are some aspects of scratch that I think could apply to a real IDE. Drag and drop constructs, statements, objects etc may b e a simplification too far, but the graphical representation of them seems a lot better than simple code colouring …
Scratch 1.3.1 (release of 21-Nov-08)
Uploaded with plasq's Skitch!

OK, it's little fisher price, and would need toning down in a real IDE, but it's also clear about what belongs where. It shows scope very well. It's not unlike Python's indentation based scope, but also more explicitly shows the end of the scope of a block with no additional code . There's no reason that this graphical representation couldn't be live generated while typing in a 'real' language. Something like this…
length.py
Uploaded with plasq's Skitch!

might look like this…
Untitled
Uploaded with plasq's Skitch!

There'd be a problem with the code becoming illegible in deep blocks. (exaggerating)…
Untitled
Uploaded with plasq's Skitch!

I think there's an advantage though. If the code is 15 or 20 levels deep in a single file/class/method/function, then there's some bad design going on there, and it should be refactored. The opacity would become a useful visual representation of the readability of the code.

No comments:

Post a Comment