Slashdot Mirror


David Brin Laments Absence of Programming For Kids

An anonymous reader writes "David Brin is an award-winning science fiction writer who has often written on social issues such as privacy and creativity. Now, he's written an essay for Salon.com titled 'Why Johnny Can't Code'. He discusses his son's years-long effort to find a way to use his math book's BASIC programming examples. All they were ever able to find, however, were either children's versions (on the Mac) or 'advanced' versions which attempted to support modern programming requirements (and which required constant review of the user's manual). Ultimately, they ended-up buying an old Commodore 64 on Ebay — Yes, for those of you under the age of 30, 'personal' computers like the Apple II and C64 used to all include BASIC in their ROMs."

52 of 355 comments (clear)

  1. There are options by mkosmo · · Score: 3, Interesting

    How about QBasic on Win95, MS DOS, etc? My first BASIC programming experiences were on one of those kiddy VTech laptops, then moved to QBasic on Win95. Worked great... simple BASIC, didn't require any special knowledge. In fact, I quite enjoyed it.

    1. Re:There are options by tmasssey · · Score: 3, Interesting
      Or a C-64 emulator, or GW-BASIC, or VisualBasic or any of a *bunch* of free or open source BASIC interpreters...

      This sounds very much made up to write an article.

      Having said that, I have tried to find kid's programming books for my 8-year-old daughter. I started learning computer programming at 8 using my Commodore VIC-20 manual. It had a little cartoon computer character that led you through BASIC programming from the typical 10 PRINT "TIM" 20 GOTO 10 all the way to "advanced" games. As a kid, I absolutely loved it.

      However, I have been able to find *nothing* like that for her... Any thoughts out there?

    2. Re:There are options by timeOday · · Score: 2, Insightful
      Why basic at all? It's a jumble. How about something clean and elegant? That's right, scheme or lisp.

      Actually I really learned to program on an HP calculator. I had previously done some C, but the simple metaphor of the stack was alluring.

    3. Re:There are options by mkosmo · · Score: 2, Informative

      I only say that because he explicitly stated the use of BASIC in his son's math book. You really cant use a C compiler to run a few lines of BASIC :)

    4. Re:There are options by cp.tar · · Score: 2, Insightful

      Lisp, Scheme, Python, Perl... anything that'll teach the kid to think and to understand.

      --
      Ignore this signature. By order.
    5. Re:There are options by Grayputer · · Score: 3, Informative

      Those are copyright MS. Try freebasic www.freebasic.net for the 'free' version.

    6. Re:There are options by tinkerghost · · Score: 2, Insightful

      RTFA - BASIC because it's what was in the textbooks at school.
      There are tons of other languages that could have been used, but each one would have required translating the code in the textbook.
      The artical wasn't about the lack of BASIC per se, but about the lack of support for learning the roots of the higher languages. Everyone says - oh, don't play with that crap - go for the higher languages - Object oriented blah blah blah. The point was that that's not how it should be done. Yeah you can learn the high order & then work your way down to assembly, but it effects how you think. When I write my own code, I write from a minimalist stance (no I don't write my own tcp/ip stacks etc), it might not be as portable or modifiable as code writen using standard libraries and structured as modules with blind objects. On the other hand, it's usualy clean, elegant, and faster than doing it with libraries.
      To put it in perspective, I have worked with people who think that cobbling together widgets is real programming & can't understand how to do anything more than the simplest coding to make them work nice together. I honestly think trying to get them to build a double linked list might give them a heartattack. That's what David's artical was about. Programming, to him, isn't about objects & high level processes, it's about understanding the processes of logic and math that transform blocks of code into something entirely different - whether the magic of a moving ball on a screen, or seeing the difference in performance for a shuttle short vs an indexed sort vs tree sort - and then understanding why each creates the results it does.
      But hey, I'm just a few years younger than him, so I'm still part of that old school approach - what do we know?

    7. Re:There are options by toph42 · · Score: 3, Informative

      That's how we did it old school. These days kids learn OO concepts with graphical programming environments they don't know are graphical programming environments. Try out Alice by Carnegie Mellon and see how kids (or adults) can create "interactive stories" that a using 3D graphical objects. It's pretty cool. Version 3 (in development) will utilize graphical models from EA's The Sims 2, to allow creation of more realistic stories (see the press release), but even with crude graphics, kids end up learning how to make a collection of objects communicate via inherent or user-added methods.

    8. Re:There are options by DragonWriter · · Score: 2, Insightful
      RTFA - BASIC because it's what was in the textbooks at school.
      Isn't, then, the problem with the school purchasing textbooks that were designed for the 1980s?
      The artical wasn't about the lack of BASIC per se, but about the lack of support for learning the roots of the higher languages.
      I'm not sure what you mean by "roots" and "higher". I don't need to learn BASIC to understand the roots of, say, C++. I don't see how learning a modern derivative of Logo (which, along with BASIC, was a common teaching language in the 1980s) is any less conducive to learning the roots of other languages than learning BASIC.
      When I write my own code, I write from a minimalist stance (no I don't write my own tcp/ip stacks etc), it might not be as portable or modifiable as code writen using standard libraries and structured as modules with blind objects. On the other hand, it's usualy clean, elegant, and faster than doing it with libraries.
      This is all well and good, but what does this have to do with whether you started out programming with BASIC, StarLogo, KPL, or anything else? If you start with any programming language and are the kind of person that's interested in learning, you'll branch out, and learn languages with different modules just to be able to do different things. At some point you'll quite likely end up learning some OO languages, some functional languages, some assembly language, and some quirky things that don't categorize all that well, among others.
      To put it in perspective, I have worked with people who think that cobbling together widgets is real programming & can't understand how to do anything more than the simplest coding to make them work nice together.
      Yeah. And there are lots of people like that. And, you know what, many of them probably learned BASIC at one point.
      Programming, to him, isn't about objects & high level processes, it's about understanding the processes of logic and math that transform blocks of code into something entirely different - whether the magic of a moving ball on a screen, or seeing the difference in performance for a shuttle short vs an indexed sort vs tree sort - and then understanding why each creates the results it does.
      Sure, that's what programming is about. But learning that doesn't require learning BASIC as your first language, nor is it, IMO, particularly aided by doing so. OTOH, it is probably aided by learning some programming language young, and having a good enough experience that you seek to learn how to do more and keep doing that over a period of several years.
    9. Re:There are options by zuzulo · · Score: 2, Insightful

      I think the Squeak project is worthy of note for anyone interested in a first programming environment. Start em off right.

      Squeak homepage

      and the Education focused site

      --
      "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety."
    10. Re:There are options by Cobralisk · · Score: 3, Informative

      Funny, we had a robotics class for "gifted studends" in my elementary school using some setup called Lego-Logo. It was around 1989-1990. It was like mindstorms. Build a little Lego gizmo, hook up the controllable parts to the computer, and use LOGO to drive it. See this for some info.

      --
      Waiting for ad.doubleclick.net...
    11. Re:There are options by sg_oneill · · Score: 2, Funny

      There also was "Alice", a python / 3d environment to teach kids object oriented coding. Python is of course a perfect first language for *anyone* as well.

      However, its a crying shame that a good solid programming language, perhaps with game making potential or some other hook for kids, isnt included with every copy of windows.

      Oh yeah old school basic for Windows: http://www.nicholson.com/rhn/basic/#5

      Its really really old school however.

      --
      Excuse the Unicode crap in my posts. That's an apostrophe, and slashdot is busted.
    12. Re:There are options by xrayspx · · Score: 2, Funny

      20 GOTO 10 isn't going anywhere.

      Sure it is.

  2. If Johnny could code... by psykocrime · · Score: 4, Funny

    ... maybe he'd code up a "dupe detector" for the /. editors to use?

    --
    // TODO: Insert Cool Sig
  3. Yeah, really. by Anonymous Coward · · Score: 4, Funny

    I mean, if I had kids, the first thing I'd do is program 'em to get up and get me a beer from the fridge. Good fer nothin' brats.

    1. Re:Yeah, really. by tivoKlr · · Score: 2, Informative
      Dude, seriously, why the AC. I was going to mod this +1 Funny as Hell, but I don't spend em on AC's...

      Oh well.

      --
      Ocean is land, covered with water.
  4. You know, though this is a dupe by drinkypoo · · Score: 4, Insightful

    It does afford me the option of wondering "aloud" why Brin didn't just download, say, an Apple ][ or C64 emulator. I mean, I always thought the guy was kind of smart, but now I know it's not true. (And don't tell me that non-computer nerds wouldn't know about emulators; if you don't know, ask someone.

    --
    "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    1. Re:You know, though this is a dupe by Vellmont · · Score: 3, Insightful

      I thought the same thing.

      The article was interesting, but ultimately the author seemed to be concerned about recreating nostalgia for programming on his 8-bit computer rather than actually wanting kids to know how to program. There's countless examples of programming languages suitable for a kid. Bash, Excel, and Javascript are all pretty simple, don't require complex steps like compiling or memory management, and readily accessible.

      --
      AccountKiller
    2. Re:You know, though this is a dupe by LunaticTippy · · Score: 2, Insightful

      My only complaint about my 64 emulator is the keyboard. The c64 keyboard had some weird keys, and it doesn't map prettily to a modern keyboard. I think a " is shift-2, but I always have to poke around a bit to figure it out.

      --
      Man, you really need that seminar!
    3. Re:You know, though this is a dupe by drinkypoo · · Score: 2, Insightful
      Personally, I think the much bigger reason is that our computers do so much more these days. Back when I got my first computer, it didn't really do a lot. Once I beat Crystal Caves and Secret Agent Man, GWBASIC was about the only interesting thing that was left.

      Yeah, I think you've really hit the nail on the head here. Actually you could get BASIC in ROM for the IBM PC-1... but alas, my machine lacked that option, and I ended up scrapping everything but the motherboard which AFAIK is still hanging on a friend's wall.

      Not just that, but those older machines (the 4-bit era) tended to show you BASIC as soon as you booted. It was ready for nothing so much as for letting you write some code.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    4. Re:You know, though this is a dupe by biobogonics · · Score: 2, Interesting

      It does afford me the option of wondering "aloud" why Brin didn't just download, say, an Apple ][ or C64 emulator.

      Even better, find an emulator that runs CP/M which also emulates various types of terminals. One fun thing about computers is making them do fun looking *stuff* like display hacks, moving the cursor, typing backwards, etc. Learn how to control the display by issuing character sequences. Find some books by David Ahl. CP/M had an incredibly rich set of simple tools. Part of the fun is that you have to do some actual building to make things work. Sample any number of the host of languages available under CP/M. Use a line editor. Print out program listings, etc.

      Use the computer as a *tool* to learn something else - like math. Number fun - magic squares - rectangular, triangular, perfect numbers. Find prime numbers and pythagorean triplets, etc. Do number base conversions. Learn dimensional analysis and units, etc, etc, etc.

      Let the child enjoy saying "Whoopie. I made this."

    5. Re:You know, though this is a dupe by Vellmont · · Score: 2, Interesting


      But seriously what could a kid do in Excel that would actually hold their interest longer than half a second?

      Write a macro the does all their math homework for them, including showing work? Figure out how long it takes them to save up for a new bike? There's lots of ways a kid could be interested in Excel.

      --
      AccountKiller
    6. Re:You know, though this is a dupe by chrisbtoo · · Score: 2, Informative

      Shift-2 is an @ sign on modern keyboards, while " and ' share a key just left of the enter key.

      Shift-2 is an @ sign on modern American keyboards. On a British keyboard, it's a ".
      --
      Registering accounts later than some other chrisb since 1997
  5. Come on... by naoursla · · Score: 3, Insightful

    I know that /. is famous for dupes, but at some point I start thinking the editors are playing a little joke on us.

  6. Uh, hello? by Dachannien · · Score: 2, Insightful

    Why pay for the cow when you can get the emulator for free?

  7. How is it that by Travoltus · · Score: 2, Interesting

    Slashdot can post dupe stories about the dearth of programming training opportunities for kids, but they can reject a story I posted about a recent study showing a LACK of programming jobs?

    Why should kids learn programming when they'll only be able to compete for a programming job if they take an East Indian's dollar-a-week salary?

    --
    --- Grow a pair, liberals... stop letting the Republicans bully you!
  8. Lego Mindstorm? by drewzhrodague · · Score: 3, Informative

    What about the Lego Mindsorm? That has a programming language. I'll bet it is way cooler to use a beginners programming language to build robots, than it was to draw boxes, or calculate your homework.

    ...and hold on, now! Where's my damn flying car?

    --
    Zhrodague.net - I do projects and stuff too.
    1. Re:Lego Mindstorm? by A*OnYourA** · · Score: 2, Insightful

      I agree. Why do parents insist on teaching kids out-dated languages that will be today's equivalent of programming on punch cards when they reach the workforce?

      As someone who started out with Java 6 years ago, I find it completely ridiculous to go backwards to BASIC. Why not make things fun, and go into a game like Second Life and open up the script editor. Or make a robot. Or make a cool website with a database backend? Then parents wonder why kids rather go back to playing WoW instead of opening up the math book to write some programs. I wish I had some hipster punchline to end this train of thought, like "BUFU MUFU"... I saw that one on Youtube, but yeah I'm too old for that and I read Slashdot, so I don't know what it means. BUFU MUFU

  9. Umm... by PFI_Optix · · Score: 5, Informative
    --
    120 characters for a sig? That's bloody useless.
  10. Despite the Dupe - I *Hated* BASIC; PASCAL Baby! by DG · · Score: 4, Insightful

    Personally, having grown up with the C64 and the Apple][ and all the rest... man, I HATED BASIC.

    It was way, way, WAY too limiting and tedious, even for my neophyte 13-year-old self.

    I really didn't discover the joy of programming until I discovered Turbo Pascal. It was like somebody unshackling me - even with the crappy PC XT CGA graphics.

    Pascal is a *great* learning language. It teaches all the good habits that will be needed for a C/C++/Perl hacker later in life, without all the administrivia involved with C, or the sheer horsepower (with all the syntactic complexity) of Perl.

    Go with Pascal as a first language, and you can't go wrong.

    DG

    --
    Want to learn about race cars? Read my Book
  11. Welcome back to Slashdot - we missed you yesterday by xxxJonBoyxxx · · Score: 5, Funny

    Welcome back to Slashdot - we missed you yesterday... http://developers.slashdot.org/article.pl?sid=06/0 9/14/0320238

  12. Get with the vibe, dude by Space+cowboy · · Score: 2, Funny

    Surely it ought to be:

    10 LET ZONK = 1
    20 LET EDITOR = 1
    30 IF (EDITOR = ZONK) THEN GOSUB 1000
    40 GOTO 30
    1000 REM DUPE POST
    1010 RETURN ... or something similar, unless you're on BBC BASIC of course - just about the only 8-bit BASIC with real structure to it

    Simon

    --
    Physicists get Hadrons!
  13. Yeh... by ijakings · · Score: 2, Funny

    A boy who searches for years to find a program that will let him do some examples from his maths book. He is like the /. King. We must find him and make him our saviour, he will lead us to victory over these so called "norms"

  14. Re:One word... by kfg · · Score: 2, Funny

    Ohhhhhhhhhhhhhhhh, no! This is a dupe story, you're not going to catch me posting again.

    Oh, wait, shit!

    KFG

  15. Re:GG by larry+bagina · · Score: 2, Funny

    Next up: Why Zonk Can't Edit.

    --
    Do you even lift?

    These aren't the 'roids you're looking for.

  16. First Big Tits Dupe by goombah99 · · Score: 4, Interesting

    perl -we 'print "Big Tits" until 1==0' Is the epitomy of every first program.

    Perl seems to fit the bill, since it can be as simple as you want and doesn't even have the type issues Basic has. Perl is happy to be procedural. When you are ready to step up to objectsperl is ready.

    Object oriented perl is a wonderful way to learn objects. Wait don't scream. I said "learn". I'd been object oriented programming for years in Java and other languages. But I truly did not understand how all the pieces worked till I wrote perl objects. In perl it's like one of those "visible man" models. You learn how inheritance works. You learn how binding of an instance to a class works. You understand closures for the first time. You understand how the namespaces are kept separate and how instance memory is allocated. It's not just some voodoo that simply works, like in JAVA. Moreover all of the voodoo is not out of reach but right there for you to mess with. An instance can change it's own inheritance if you want it to. An instance can create a new method and write it into it's own namespace if it wants to. An instance can trap calls to it's own methods and redirect them or intercept calls to methods that don't exist and respond to them.

    Those features are not unique to perl (for example pyhton implements objects identically to perl). The difference is that All of that object management occurs in perl itself and is not hidden behind syntactic sugar (like python and java). You quickly appreciate what dereferencing costs, etc...

    The other thing that is nice about perl for learning is all of those prefixes like $ @, and so forth. They may make perl look like cursing but they force you to think about what a variable is. When I index out an array, I get what? an array? no I get a scalar, so $X[2] is how I index @X. You can look at someones perl program and if it's written well tell what every word is. You cannot look at a bare name in python or java and tell if it's a method, an array, a hash, a scalar or reference. Perl you can. (Oh and by the way let me explode a perl/pyhton myth. python has more special markup characters in use than perl, the main difference is that in python they are suffixes instead of prefixes and are overloaded with multiple meanings--try counting how many modifiers there are some time (e.g. () , [] ** and so on))

    Now once you learn perl objects. Well it's time to put down the perl and back away slowly. Python, java are much better languages for writing re-usable, easily read, complex object oriented programs. Perl is still a much more powerful language than either. But it's powerful for efficiently creating compact or single use programs quickly. Not for well designed complex systems.

    Perl is good language to start in, plus it's useful enough to work throughout your career. Basic is not.

    --
    Some drink at the fountain of knowledge. Others just gargle.
  17. Correction by PFI_Optix · · Score: 3, Funny

    10 Post news item
    20 goto 10

    --
    120 characters for a sig? That's bloody useless.
  18. http://dups.slashdot.org/ by neonprimetime · · Score: 2, Interesting

    You know what's even funnier? The link I created in the Parent works! And it takes you to the /. home page! hahahahahahahahahahahaha

  19. A c64 from eBay? by Weaselmancer · · Score: 2, Funny

    Good lord man. Why go through all that trouble?

    The article should be called Why Johnny Can't Freaking Use Google.

    --
    Weaselmancer
    rediculous.
  20. Kids are more computer literate than us: too bad. by Nijika · · Score: 2, Insightful
    He can lament all he wants, the truth of it is the percentage of kids that have access to computers in the first place is much higher, and the number of computer literate kids that will come out of that expore to completely replace and out-do us will also be much higher.

    I don't think the antiquification of DOS, and of all things, BASIC, is going to have some negative effect.

    We'll always have to suffer the hand-wringing from a generation getting older, and I'll always roll my eyes about it.

    --
    Luck favors the prepared, darling.
  21. Flame Baby Flame by neonprimetime · · Score: 4, Funny

    Kids that grow up to learn Python are more presentable and well mannered that those that grow up to learn Perl. Flame On!

    1. Re:Flame Baby Flame by sceptre1067 · · Score: 2, Interesting

      so what does that say for kids raised on Ruby... or Haskell. ;-)

      One scary article I encountred (on ora.com) suggested starting kids out on tcl/tk.

      YMMV.

  22. Changing World: Low % Who Grow Their Own Code by G4from128k · · Score: 5, Insightful

    I too have lamented the changes in IT. When I first learned to program (1977 on an HP-25), the technical environment was very different. Back then, everyone who wanted to use a computer HAD to know how to program. The scarcity of software meant that everyone wrote their own code or, at least, typed in code from a magazine. Very limited software sharing schemes and the inability to quickly find software meant it was easier to write your own than to find someone else's software. Simple languages, simple hardware, simple interfaces, and simple APIs ruled. When the entire OS plus application suite resided in a few k of RAM, it was easy to both work with the system or create your own. It took very little effort for a novice programmer to produce world-class code because the bar was so low and the functionality so primitive that anyone could make something interesting. In the old days, everyone grew their own code.

    Today it's all different. The OS has become a beast that not even a team of programmers can fully comprehend. IDEs, OOP, and layered architectures try to hide the complexity, but its still there. Moreover, almost any bit of code or application that one might want has a multiple incarnations ready for buying/downloading from commercial/shareware/OSS sources. It's now very easy to find the application you want and much harder to write something that is better than anythign else. In the new days, few grow their own code.

    Perhaps its like the change from a subsistence-agrarian world to a world of craftsmen (or industry) where programming is like farming. In the past, everyone grew their own code. Today, no one grows their own food and farming is a very minor part of the global economy. Farmers may lament that most children in the city don't know how to milk a cow or thresh wheat, but perhaps those skills aren't needed in most people. Just as one farmer can now feed some 40 people, one programmer servers the programming needs of a growing number of users. Consider that Microsoft as 60,000 employees whose code runs on at least 600 million operating PCs -- more than 10,000 non-programming users per programmer.

    As with farming, we now live in a world where few need to grow their own code. As far as schools are concerned we may be entering a world in which fewer than 1 child per class will ever need to know how to program. That makes me sad at some level, I truly enjoyed learning to program, but it may be an inevitable part of the maturation process for IT and the internet.

    --
    Two wrongs don't make a right, but three lefts do.
  23. download this.... by scharkalvin · · Score: 2, Informative
  24. Windows only by JoeCommodore · · Score: 2, Funny

    Nor does it seem to be open source - so low poosibility of porting it.

    God that is sooo 90s.

    I'd reccomend Python.
    --
    "Enjoy what you're doing! If it becomes drudgery, you're doing it wrong!" - Jim Butterfield
  25. Re:Despite the Dupe - I *Hated* BASIC; PASCAL Baby by jsebrech · · Score: 4, Insightful

    Personally, having grown up with the C64 and the Apple][ and all the rest... man, I HATED BASIC.

    I started out on a C64/C128 as well. Basic is not a good first language.

    Frankly, if I wanted to teach my child programming, I'd start with javascript. Here's why:
    - It's extremely easy to get started in. You can do a lot with one-liners, and unlike perl you can explain the one-liners to a neophyte. There are many excellent beginner's books.
    - On-screen graphical feedback is instantaneous, and you don't have to restrict yourself to console output.
    - Every single web-enabled PC has the development tools right there. They don't have to do complicated installs, and they can show off their 1337 skills on their friend's computer.
    - And best of all, if you give them a simple hosting account they can place their javascript programs online for all their friends to see.

  26. Re:Despite the Dupe - I *Hated* BASIC; PASCAL Baby by An+Onerous+Coward · · Score: 2, Interesting

    That's a point I hadn't thought to make last time this story came around. I started programming on a Commodore64 when I was 7. Not a prodigy; I programmed about as well as you'd expect a 7 year old to program. Copied short snippets from books and whatnot. By ten, I was using basic programming flow to draw interesting patterns on the screen. At the age of thirteen, I tried my first truly ambitious project: a 'Dragon Warrior'-style RPG.

    It was a catastrophe. When I first started composing this, I was going to blame it on BASIC itself, then on the crappy line editor I was trying to use. But as frustrating as these things were, my greatest shortcoming was that I had no adult supervision. When you try and teach yourself, rather than learning from an expert, you tend to not realize when you've missed something very, very important.

    I feel a deep sense of shame even today for admitting this level of stupidity, but I didn't know what a subroutine was. Knowing that I could have called the same snippet of code from different parts of the program would have saved me much heartache, but I had the concept of a flowchart firmly in my head, and it seemed to demand a single, unbroken flow of execution. Which demanded cut-n-paste. Which I couldn't do with that crappy line editor.

    Thinking on it, I should probably try tackling that project again, so that next time I set down to writing a long anti-BASIC diatribe, I'll at least know what the hell I'm talking about.

    --

    You want the truthiness? You can't handle the truthiness!

  27. Re:Teach them PHP by BradWilliams · · Score: 2, Informative

    Actually, I learned PHP 3 years ago... I was 13, and it's actually a good way to learn programming syntax without without having to learn about writing classes, methods/functions, etc right from the start, but still learning some basic OOP (writing your own functions and using them). Now I'm learning Delphi(I realize that the syntax is totally different) & Java, but PHP was a good way for me to get into programming... plus it makes me some cash.

    --
    Regards, Brad Williams
  28. Re:Perl OO by corporate+zombie · · Score: 2, Interesting
    Learn Object Oriented Perl --

    In perl there are references. A reference is created by \ on a container.
    my $scalar_ref = \$a_scalar;
      my $array_ref = \@an_array;
      my $hash_ref = \%a_hash;
    or you can create a reference with anonymous array and/or hash syntax.
    my $array_ref = [ 1, 2, 3 ];
      my $hash_ref = { "a" => 1, "b" => 2 };
    A reference can have a namespace associated with it. This is done with bless(). Such a blessed reference is called an "object".
    my $obj = bless( {}, 'My::Class' );
    Subroutines can be written to work on objects. They expect their first parameter to be the object being worked on. Subroutines that expect an object as their first parameter are called "methods". Often this parameter, by convention, is named $self.
    sub do_something {
        my $self = shift;
        # do something
      }
    If you use an '->' between an object variable and a subroutine then the parser rewrites this to provide the object as the first argument to the subroutine.
    $obj->do_something();
    A method call is first searched for in the package the object is blessed into. If it is not found there the package's @ISA array is examined. Each namespace in the @ISA array is searched (while in turn any @ISA's in that namespace is searched if the method is not located in the namespace) until the first method is found or none is.

    That's it. Everything else you can put together from general OO techniques.

    Here's a small Point class. _init() is seperated from new() so that any sub-classes of Point (those packages that have a @ISA list with 'Point' as an element) can override it without having to rewrite new(). Alternately a sub-class could do some additional work and call $self->SUPER::_init(...) to call _init() in some super class.
    package Point;
    use strict;
     
    sub new {
      my $class = shift;
      my $self = bless( {}, $class );
     
      $self->_init(@_)
     
      return $self;
    }
     
    sub _init {
      my $self = shift;
      my %av = @_;
     
      $self->{x} = $av{x};
      $self->{y} = $av{y};
    }
     
    sub scale {
      my $self = shift;
      my $factor = shift;
     
      $self->{x} *= $factor;
      $self->{y} *= $factor;
    }
     
    1;
     
    __END__
  29. Re:Despite the Dupe - I *Hated* BASIC; PASCAL Baby by Bastian · · Score: 3, Funny

    If I wanted to tech my child programming, I'd start with Scheme. Here's why:
    - I hate loops
    - I hate variables
    - I hate kids

  30. Re:I was the submitter of this dupe by DragonWriter · · Score: 2, Informative
    I think what Brin wants (and I'm in the same boat though my kids are still just toddlers) is something comparable to learning to write in BLOCK letters, i.e., a temporary stepping stone to more sophisticated methods or languages or cursive writing.
    I think StarLogo TNG's use of drag-and-drop blocks is a pretty interesting approach to exactly this need. The blocks have text which allows them to be read like typed-in code, and colors and shapes that indicate function and syntax.
  31. Re:syntax error at yourcomment.pl line 1, at EOF by sg_oneill · · Score: 2, Insightful


    Yeah, seriously I'd avoid teaching kids PERL. One problem basic DID have is it taught a few bad habits (Goto's, bad variable nameing , etc). Perl unfortunately in its quest for "More than one way to skin a cat", allows some shocking codeing, and unfortunately my eternal grip with perl, is it begets shocking code. "Hey , you have a language that lets you do cool stuff like closures and stuff (I think?) and you are using fucking $_@ variables and using regex's to traverse DOM trees. STOP PROGRAMMING, YOUR NOT GOOD AT IT!". ehh.

    Python I thinks the clear choice. Its simple minded enough to teach to children (Kids, its all about hash's , lists and atoms), but is actually a real world language that allows some pretty fancy and efficient and READABLE stuff. It might not have the same eseoteric-beard status as lisp or scheme, but its a pretty damn nice language regardless, and you can actually get jobs codeing in it. And later on they can learn perl, once they've learned not to abuse perl.

    --
    Excuse the Unicode crap in my posts. That's an apostrophe, and slashdot is busted.