tags:

views:

468

answers:

15

In a number of these conversations, developers fondly remember their very first program. It tends to be a variation of this:

10 print "My brother Michael is a greebly"
20 goto 10

Personally, I remember the moment, and the extreme awe I felt. Computers were these amazing things that had text floating on the screens, and suddenly I had the power to control this text. From then on, all I wanted to do was go to my parent's workplace and write programs in basic.

With kids now days, this experience just wouldn't cut it. Computers aren't about text - they're about windows and images.

I would love to instill this feeling I had into my own children, but I'm starting to wonder if it's even possible.

Can somebody think of the entry-level first program to teach somebody who was born this decade?

+9  A: 

I think text on a screen would be fine - even for someone born in this decade. There is still something cool about telling the computer to say something and then see the computer regurgitate it back at you.

I would suggest Python as a good teaching language for kids because Python does not require you to expose all the language's features to start coding.

For instance this Python program is much easier for a kid to understand:

print "hello, world"

as apposed to this C# program that does the same thing:

using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("hello, world");
    }
}
Andrew Hare
But Java, C# and C++ do at least have a sensible rationale for how their code is arranged. What is so special about "print" that it "just works" in simple Python programs?
anon
No, I agree that other languages have a sensible rationale, it is just that when explaining how things work to a child you don't have to tell them "just ignore the using, class, static, void stuff" when you use a language like Python.
Andrew Hare
@Andrew At least for the first five minutes :-)
anon
Aha - I guess no approach is perfect though :)
Andrew Hare
OK, based on this suggestion I showed my 6-year old python. He's already doing stuff like this: p='poo' q=10 p*q. The console says "poopoopoopoopoopoopoopoopoopoo". His first program. This is a poignant moment in the life of a parent.
Andrew Shepherd
+1  A: 

This is a pretty good approximation of the one I used to do in applesoft basic to torture my brother ...

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("What's your name?");
        var ans = Console.ReadLine();

        if (ans == "JP")
        {
            Console.WriteLine(ans + " is awesome");
        }
        else
        {
            Console.WriteLine(ans + " is a doofus");
        }
        Console.ReadLine();
    }
}
JP Alioto
That was one of the first programs they taught us in uni, except the lecturer was the 'awesome' one. Guess how many people changed it :p
glasnt
+4  A: 

Take a look at Scratch from MIT. It has all the elements that you are looking for (Graphic, sound, window, including programming concepts like assignment, loop, conditional, etc.).

Jimmy Chandra
+1  A: 

You can use the picture with brothers photo, and when clicking on the nose, show the message "Not to my nose"! Or something like this :)

Alex_L
And you can change the mouse pointer to hammer :)
Alex_L
+8  A: 

Take a look at Microsoft SmallBasic (www.smallbasic.com). There is a smallbasic tutorial, about 60 pages, that covers the stuff we all learned in the beginning and then moves onto turtle graphics. Smallbasic even comes with a simplifed UI so they're not scared off by the UI of VS.

I installed SmallBasic for my 11 year-old. She spent the day with me at Code Camp and afterwards said she wanted to learn programming. So far, she really enjoys it.

Scott
I've been using SmallBasic to get my 9-year old niece interested in programming - the simplified UI is great and you can "upgrade" the program to VB.net later.
Jazza
I was just listening to this podcast on teaching kid's programming, using smallbasic: http://www.dotnetrocks.com/default.aspx?showNum=562
Andrew Shepherd
A: 

You could also look at Greenfoot. I've had a play around and it didn't seem too bad. Haven't tried it on any children myself though.

dave
A: 

Possibly introducing them to Perl with Gtk,Gtk2 lib's and perl modules would be awesome; but of course this only works if they know/understand Linux. If not, you could always introduce them to Java and Swing as this is the normal "language of choice" for first languages today. Personally I'm teaching my daughter C/C++ and telling her to deal with it... She's going to hate me :P

Suroot
+1  A: 

I think Alice from Carnegie Mellon University will be great for kids. Checkout http://www.alice.org/index.php?page=what_is_alice/what_is_alice

Babar
A: 

The first programming language nowadays is JavaScript:

<html>
<head>
<title>What is Michael?</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;
<script>
  $(document).ready(function() {
    function taunt() { 
      alert("Michael is a greebly"); 
      taunt(); 
    }
    $("#btn_taunt").click(taunt);
  });
</script>
</head>
<body>
  <button id="btn_taunt">Press button for answer</button>
</body>
</html>

You can do everything in JS Bin to start, and then move to Bespin. Into the Cloud!

Thomas L Holaday
Ack. Have you tested that program? it's a really good way to lock up a browser.
Breton
Also, there's a lot of overhead in that program. I'd rate it as 5th or maybe 10th program, but not first.
Breton
@Breton: Locking up the browser is the whole point! The program in the original post fills the screen with "Michael is a greebly," in an endless loop.
Thomas L Holaday
@Breton: If you use JSBin as your development environment, all the overhead is isolated on the HTML tab.
Thomas L Holaday
@Breton: It locks up IE8, Firefox, and Safari on Windows, but both Opera and Google Chrome allow the <strike>victim</strike> user to elect to forbid the page from creating more dialogs.
Thomas L Holaday
I concede that a child may find that amusing.
Breton
+5  A: 

I instilled this experience in an 8 year old child recently. I directed him to type

javascript: alert("hello world!");

into the URL bar of a browser. from there he was excited, so I had him try

javascript: var name = prompt("What is your name?"); alert("hello "+name);

That was all I had prepared in advance, but his hunger for these things was insatiable. Soon we were changing the backgrounds on his favorite webpages, replacing link text, making things dance around. javascript urls are quite a powerful stepping block, because it's changing something mundane (a browser) into something the child can now control in various ways. And it doesn't require a whole lot of setup and fussing about with text editors and HTML before you see results like the other javascript suggestion does. That shit is boring. We want one simple command that makes the computer jump in an unexpected way, and suddenly you've got yourself a programming junky.

Breton
+1 for JavaScript, but I recommend using JS Bin so that you can move to multi-line programs easily.
Thomas L Holaday
For lockup-the-browser goodness, javascript: function pwn() { alert("That's what your mom said!"); pwn(); }; pwn() ;Google Chrome browser detects the loop and allows the user to stop the page from creating more dialogs. Internet Explorer does not. Surely your child will not use this knowledge to make mischief on unguarded PCs running IE.
Thomas L Holaday
A: 

Slashdot pointed out the new "Kodu" visual programming language for kids:

http://news.slashdot.org/story/09/07/11/2124218/How-To-Teach-Programming-To-Kids-Via-XBox

Video demo: http://xbox360.ign.com/dor/objects/14310459/kodu/videos/ces2009sync_kodu_dem_010909.html

Could be the new 20 GOTO 10...

Shane Cusson
+1  A: 

Keep an eye on Hackety Hack. It is currently undergoing some changes, but the old version is still available, as well as a sister (for lack of a better word) project called Shoes. Hackety Hack and Shoes were created as an answer to questions like yours. See this essay written by the author. He also writes about other languages that scratch similar itches on his blog.

Inching Forward
A: 

My lecturers at Kent University created a language for children in the OO day and age: http://www.greenfoot.org/

I'd say, the most most exciting first bit of programming would be a HTML hello world: "MY own webpage?!"

StuperUser
A: 

I'd probably suggest Smallbasic or another BASIC variant. It's not very geeky, but it's easy.

Paul Nathan