Page 1 of 1

Amazing what kids can learn

Posted: Sun Dec 17, 2006 3:38 pm
by RobertGonzalez
So my 10 year old daughter asked me to teach her how to write programs 'like you do at work daddy'. So I brought her into the room, opened up and editor, had a brief discussion on servers and server-side language scripts, then explained what PHP is and how it works on the server, then had her write her first program.

Code: Select all

<?php
echo 'hello world this is sarah';
?>
This evolved into

Code: Select all

<?php
$text = 'hello world this is sarah';
echo $text;
?>
At about this point my nine year old came and asked to participate along with us. So we got to throwing some stuff out and this is what we ended up with after about 20 minutes:

Code: Select all

<?php
$text = 'hello world this is sarah';
$num = 10;
$joiner = ' and I am ';

if ($num == 10)
{
    echo $text . $joiner . $num;
}
elseif ($num == 11)
{
    echo 'I am 11';
}
else
{
    echo 'I am totally not 10';
}

echo '<br />';

$counter = 0;
$limit = 100;
$inc = 10;

while ($counter < $limit)
{
    if (!($counter % 10))
    {
        echo '<h2>10 is a modulator of ' . $counter . '!</h2>';
    }
    else
    {
        echo '<p>I am only ' . $counter . '</p>';
    }
    
    $counter += $inc;
}

$now = time();
echo date('l F jS, Y', $now);
?>
My daughters, in about 20 minutes, now understand how to declare and assign a variable, how to tell PHP what a string is and what an integer is, how to write a conditional (if/elseif/else), how to write a while loop, how to increment a counter, how to use a function (and what a function is) and how to read the PHP manual. Frickin amazing.

Me: How does PHP know when it is the end of the line?
They: The semicolon.

Me: What do the quotation marks on a variable value mean?
They: That the value is a string.

Me: If we loop do a while loop where a var is less than 100, what is the maximum value we'll see when echoing the increment value?
They: 99.

Me: And if we change the increment value to 10, what is the largest value we'll see?
They: 90.

Unbelievable. Even a 9 and 10 year old can get this pretty quickly.

/ apologizes for the blog like post, but I just wanted to encourage those folks that think this is too hard to pick up on. Start slow and it can be learned. Just ask my kids.

EDIT | I should note that they are by no means pros at this. But they have a strong understanding of the concepts, as evidenced by their ability to tell me what would appear on the screen as they read the code line by line.

Posted: Sun Dec 17, 2006 3:44 pm
by Chris Corbyn
So are we going to have a couple of new Everahess members here then?

Posted: Sun Dec 17, 2006 4:18 pm
by Ollie Saunders
Yay for Everah's kids!

I really don't think age has anything to do with intelligence once > 7 or so. Knowledge is built on top of knowledge which usually makes adults able to learn more quickly but when it comes to learning your first programming language whether 9 or 20 its likely to be alien enough to give the 20 yr old no significant edge.

Posted: Sun Dec 17, 2006 4:30 pm
by timvw
I can only agree with Everah... A couple of years ago i found some old code (some Basic dialect for the Radio-Shack Personal computer with a lightning speed of 1Hz and 16K memory ;)) written on paper that i had written as an 8y old... I can remember that it was relatively easy to get the grasp of the basic structures...

Posted: Sun Dec 17, 2006 5:34 pm
by Trenchant
Thats awsome.

For your next "project" you should see if they can build a simple login area.(no db just if $user kinda thing)

I remember when I was younger that was the biggest thing I wanted to be able to do. Once I got that I was hooked on PHP.

Posted: Sun Dec 17, 2006 6:03 pm
by Ollie Saunders
timvw wrote:Personal computer with a lightning speed of 1Hz
1Hz eh? Sure that wasn't a clock you were working on there timvw :P

Posted: Sun Dec 17, 2006 6:19 pm
by sweatje
I blogged a bit about coding sites for my kids. Later we were making a quiz site for Harry Potter questions as well, in which she participated in the coding much more.

Re: Amazing what kids can learn

Posted: Sun Dec 17, 2006 6:22 pm
by jayshields
Everah wrote:Me: What do the quotation marks on a variable value mean?
They: That the value is a string.
Make sure they know that if they go into Java that single quotes surround chars and double quotes surround Strings!

Posted: Sun Dec 17, 2006 7:37 pm
by RobertGonzalez
All Java learning for them comes when (or after) I learn Java. Which will probably be rather soon.

Thanks for all the positive posts. I think they will enjoy them when they read this.

Posted: Mon Dec 18, 2006 2:07 am
by matthijs
So they learned in 20 min what took me 2 weeks?

That's it, I'm switching to another profession. Any ideas? Carpentry seems fun. Mmm, or maybe forester or something ...

Good luck to the Everahs, I wish you all the best! (do make sure they take sensible user names like Everah jr 1 + 2 so that we can know who's writing what :)

Posted: Mon Dec 18, 2006 3:45 am
by visonardo
mmm, so good. but remember that you are reading (he) your native language or him. Its so different to who talk other language like mm french, spanish or other because first need to learn english to understand the code as your kid ( "almost" all language as far as i saw are in english language their sentence) , if its not thus, will take more time of course because is reading words that doesnt know whats does for (for example) means, for example "switch" (to spanish talker native).

But So good by your kid eh, i guess that´s so intelligent :P

Posted: Mon Dec 18, 2006 7:44 am
by RobertGonzalez
I totally understand where you are coming visionardo. So in addition to PHP, I am teaching them Spanish and Sign Langage (and even though English on our native tongue, we are still learning it from the Latin and Greek roots, which makes understanding French, Spanish, Italian and Portuguese a little easier to understand for when we start teaching them those).

But thanks for the vote of confidence for the kids.

Posted: Mon Dec 18, 2006 12:41 pm
by visonardo
(i didnt tell you,..)

Congratulation! :D

Posted: Wed Dec 20, 2006 9:50 am
by Obadiah
yea...kids are like sponges bro....i say if you kept it up they would be just as good as you...plus or minus a couple of coding tricks or techniques...the only thing ive noticed though is that when kids are exposed to something at a young age sometimes they tend to grow out of it...ive seen other examples though...where parents was like they used the type of learning as a reward and the kids grow up awsome at it...it would be cool to have them join us on the boards...lol...although i have a feeling that if they keep picking up at the rate their picking it up now...im gonna feel like a programming noob more often :lol: