Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Hi all,

I am just about to begin a course in programming to a bunch of 12 year olds at my son's school.

To the dismay of some, and the amusement of others, I will be using Perl as my language of choice.

At work, many accuse me of using this course as an evil plot to convert the world's future programmers to the perlish way of doing things. All I can say to that is,

"Bwa Ha ha ha ha!"

On a more serious note, I would like to have comments regarding what and how I will teach these young impressionable children.

Firstly, after have taught children before (many many moons ago), I can honestly say that if I were just to teach programming the same way that we teach adults to program, the children will become bored very quickly. They want action!

So, I thought about it some, and decided that we would have a project, where we would create a simple interactive game. Remember the old DOS game "nibbles"? It's the worm that has to eat food, gets bigger and bigger, and cannot eat it's own tail.

There are other things to consider as well. This is an after-school course, and there are no marks, grades, or other such stuff. My goal is to teach the children the basics, let them play with the more advanced stuff with out necessarily understanding all the intracies and details. Hopefully this will inspire a few of them to learn more after the course is finished.

In preparation for this course, I actually wrote the code (using Tk) for my own version of the nibbles game to see how easy it is, and what knowlege would be required of the students. I think it's not too bad.

Here is a simple 'sketch' of my course plan. Any comments (please be gentle) are appreciated.

Always, always, use good comments!

Item

Explain: (1) how to use an editor, (2) what is a perl script, (3) how to run a perl script.

Create simple hello world scripts. Run them. Explain each line, especially how use strict; is almost mandatory. Play with the colours of Tk.

#!/usr/bin/perl use strict; print "Hello World\n";
and
#!/usr/bin/perl use strict; use Tk; my $mw=MainWindow->new(-title=>"Hi Kids!"); $mw->Label(-text=>"Hello World")->pack(); MainLoop;

Concepts to Learn

* the shebang line (although not needed for Windows, why not?)
* use strict
* quotes
* (variables to be skipped until later)
* the use statement, what libraries/modules are, re-use of code, etc
* command line vs gui
* symple syntax rules

Item

Show where to find the documentation (we are using ActiveState on Windows). Explain about web-forums, although I don't think they would be quite ready for perlmonks yet.

Item

Start with a very simple Tk window, with a canvas object, and a rectangle on it. Make it move. Again, let the kids play with the colours.

Design

must design a grid, where to move, etc.

Concepts to Learn

* variables
* Tk function canvas
* Tk canvas function create_rectangle
* Tk function repeat
* subroutine callbacks (very simplistic explanation at this time)
* simple debugging via print statements

Item

Once we have a moving square, control it via the arrow keys.

Design

Use a simple variable to keep track of what direction the square is moving in, change this variable depending on what key is pressed.

Concepts to Learn

* binding to events
* logic statements (if (...) {...}))
* passing parameters to subroutines

Item

Detect if square bumps into the edges of the canvas

Design

Create border edge of canvas object. After every move, check if square coordinates are outside of allowed area.

Concepts to Learn

* loops and conditional loops
* unless
* stopping Tk repeat functions via cancel
* returning information from a subroutine via return
* get coordinates from a Tk canvas object

Item

Take time out to play with the colours, the sizes. Let the students personalize their own program.

Concepts to Learn

* The programmers are the masters of the program
* computer colours (red-green-blue) etc

Item

Make a food pellet and eat it. Keep score.

Design

How to place food. Where, when, etc. Keep and display score.

Concepts to Learn

* random function
* Tk label
* pointing to variable addresses i.e. -textvariable=>\$score
* variable scoping
* Probably lots more debugging via print statements
* Why $x==$y doesn't always work for floating point numbers, depending on the operating system, etc. etc. etc.

Item

Make the worm grow when it eats the food. Lose game if the worm eats it's own tail.

Design

Make a worm out of an array of rectangles. When moving worm, just move tail to where the new position of the head should be. Add new rectangles at tail position as worm grows.

Concepts to Learn

* arrays
* array order
* push,pop,shift,unshift
* looping over arrays (foreach)

Item

Add sounds

Design

Decide what events should trigger sounds.

Concepts to Learn

* using gooble
* how to find free sounds using google
* use Win32::Sound
* directory structures
* use FindBin

Item

Add start/stop/continue buttons

Concepts to Learn

* Tk buttons
* more binding
* Tk colours (background vs highlightbackground, etc.)
* Cleaning up old stuff before restarting game

Item

And so it continues, with the students driving the modifications at this point.

* Change the scoring depending on how many moves the user makes before eating the food?
* Different levels with different obstructions?
* Different difficulty levels (vary speed, size, etc.)?
* Keep a best score page (This would be good because it would involve learning about files, reading and writing to them, maybe even simple parsing, sorting in order of who's best, etc.)?
* Making a menu?

I volunteered for this. Now I'm panicked. Too late to turn back.... AAAaaaahhhh!

Remember me fondly,

Sandy


In reply to Teaching Children How to Program by Sandy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (15)
    As of 2014-11-24 20:46 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My preferred Perl binaries come from:














      Results (147 votes), past polls