http://www.perlmonks.org?node_id=451340


in reply to How to introduce 8 year olds to (Perl) programming?

Great question - I'll have to bookmark this thread.

I have an 8 year old too. Codes and ciphers are real popular with her and her classmates right now. About a month ago I took her to the library and she checked out every book she could find, and she's spent hours creating her own substitution ciphers.

A few days ago she asked me if I could teach her how to "hack". I thought this was a great opportunity, so (after I explained the difference between "hack" and "crack") we sat down with paper and pencil and worked out what would have to happen to encrypt and decrypt a simple message. Then we sat down at the keyboard together and duplicated rot13, and she loved it.

It gave me an opportunity to talk about how characters are displayed, chr and ord, then tr. Since then, she's asked probably 10 times what else she could learn!

Our next project is printing triangles. You know the type...

X XX XXX XXXX
I'm going to start with hard coded print statements and from there teach her about loops.

Bottom line, I'd start with something fun that catches their attention as well as gives you a chance to explain some of the basics - I/O, conditionals, simple calculations, character manipulation, graphics, flow control, etc. If your presentation entertains, you'll engage more of the kids.

Whatever you decide to do, please post the results back here so we know how it turned out.

Replies are listed 'Best First'.
Re^2: How to introduce 8 year olds to (Perl) programming?
by DrHyde (Prior) on Apr 26, 2005 at 09:26 UTC
    This is an excellent idea. By using very simple encryption as your example - eg the Caesar cipher or the Vigenere cipher - you should be able to teach them something useful in twenty minutes. Start by teaching the Caesar cipher, then show how quickly and easily it can be broken using brute force or trivial frequency analysis, then introduce the Vigenere cipher and show that it doesn't fall to either attack. At least, it doesn't when you're working with a pen on a whiteboard.

    And most importantly - don't teach encryption, or ciphers, or algorithms, or programming. Teach them how to pass secret messages to their friends that their teachers won't be able to read.

    Details about the Vigenere cipher are here.