Hacking for Kids

[Here’s another one in the long list of ideas I’d like to execute but will probably never have time.]

If kids learn programming these days, it’s usually LOGO or BASIC or some other training-wheels language. This is no way to breed the next generation of hackers. And I’m sure there are geeks around the world who would love their sons, daughters, nephews and nieces to get into programming, but look down the shelves of their bookshop with a cry of despair. It seems to be a choice between “Visual Basic for Dummies”, “Programming Excel” and “Learn C in 24 Easy Lessons”. As Dijkstra famously said, “”It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” And when you are learning to program, you want to write programs which do stuff, not have to spend ages in C managing memory and making sure your strings are terminated with \0.

Sometimes these books come with a CD, containing a cut-down version of a commercial development environment they are hoping you will buy, and perhaps a weedy editor, all running under Windows with no source code available. What sort of example is that to set? Trying to learn to hack on a Microsoft Windows machine or any other closed-source system is like trying to learn to dance while wearing a body cast.

How about a book “Hacking for Kids”?0 Written for teenagers, it would explain how cool hacking is and the path to becoming a hacker, and would give kids fun and interesting programming projects using powerful modern languages such as Perl, free Java, Python and JavaScript. It would teach best practice in programming, not treating the user as an idiot who can only cope with cut-and-pasting code chunks in a jigsaw-puzzle fashion.

The obvious problem is that, before the revolution, most kids will still have Windows on their home computer, and parents tend to frown on suggestions from their 12-year-old which go along the lines of “Hey, Dad, there’s this cool new operating system – er, that’s like software which controls the computer – called Linux that I’d like to use to learn to program. Can I install it on our computer alongside Windows? It probably won’t mess it up. I promise.” The publishing company might also quail at the thought of the tech support calls.

So, the book would include either a Linux LiveCD, or something based on coLinux which allows you to boot your Linux desktop in a Windows window. Then, of course, you can give them access to decent free editors, compilers, scripting languages, webservers, development environments etc. etc. All the manuals, references and source code samples for the languages and projects would be pre-installed. It would use various cool loopback/filesystem overlay tricks that the LiveCD community have invented to store all the kid’s programs and other configuration data on the computer’s real hard drive. And, of course, it would include the source for, and ability to rebuild, all the tools – and at least one project would involve hacking on, say, the editor to add a new feature to it.

How compelling would that be?

[0] Of course, in the real world, you wouldn’t be able to use that title :-(

27 thoughts on “Hacking for Kids

  1. Yeah, do it! We actually really need this sort of book. I’ve learned some Pascal long time ago, before I realised that programming means mathematics, which took me to the reason that it wasn’t the thing for me.
    And make sure the book is translated in many languages.
    :-)

  2. Isn’t the point of OSS that it runs on any OS. Linux is not a prerequisite to programming. It’s a better option later on, once you know what you’re doing. But putting people into a moving airoplane and then handing them the controls and starting at lesson one isn’t the best way (or safest) way to learn.

    A book like this should start with all the windows tools on disk so that the person can start learning to program and then introduce linux in a later chapter, with the ability to boot onto the LiveCD.

  3. Have you seen the amount of documentation Microsoft offers?

    I do think it is hard to beat them in that respect, and documentation is really important for the success of a language. That�s one of the reasons why I prefer C# over Java, because the Javadocs are pretty much abysmal. The last time I have seen a simple clear code sample in the Javadocs is… well, never, actually.

    Also, if you want to learn kids how to program, wouldn�t it be better to set the system requirements a bit lower (as-in not throw them headfirst into a whole new OS just to learn how to program)… All the languages you mentioned work in Windows, too, you know. I�m missing C# for Mono (or rather, .NET) in your list by the way, I think it is the easiest and best language I�ve encountered so far.

    And finally, I learned programming using (MSX-)BASIC, and even did a small bit of LOGO, and I don�t at all think I am spoiled forever :). They were great times.

    ~Grauw

  4. “They were great times”

    Indeed, I used to code BASIC on a commodore64, and then progressed onto 6502 ASM. I would hardly call that “mentally mutilated beyond hope of regeneration” at the age of 12. Coding isn’t necesaryily about the keywords of the language – it’s how you put them to use. VB.NET and C# are no different apart from their keywords. To say that using VB.NET makes you retarded is the statement of a retard themselves.

  5. Kroc: I think it’s important to introduce kids to software freedom – that is, the freedom to hack on, change and improve your environment. You can’t get that using tools on Windows.

    Laurens: Microsoft do provide a lot of docs, but there are good docs for free languages too. Until recently, Microsoft didn’t even provide a free compiler; they do now, but you’d need to ask them in order to ship it, and AIUI it’s crippleware compared to the full version. Again, what message would that be sending?

  6. What is it about Windows that makes it more “restrictive” than Linux? Yeah, if you want kids to grow up as kernel hackers or whatever, but suggesting that anyone is going to start learning to write software by hacking on some actual part of their OS is silly (nobody started programming by hacking Nautilus). Drumming the Free Software ideology into them is as simple as letting them know that the source is available, without encouraging them to do themselves permanent damage by introducing them to implementation details like C (or X, or Apache).

    Then you just start telling fibs:

    Until recently, Microsoft didn’t even provide a free compiler; they do now, but you’d need to ask them in order to ship it, and AIUI it’s crippleware compared to the full version.

    This is an entirely accurate statement, except for the small points that (a) it’s a free download and (b) people are using it to build Mozilla all the time, so one has to wonder what the extent of its cripplitude is.

    Having said that: New programmers should be brought up learning Python or C#. (I wish I had been: it’s ridiculous that I passed a third-year university module using 6502 assembly knowledge I’d acquired as a seven-year-old.) They’re powerful, well-supported and documented and can be used to write fantastic modern, cross-platform graphical applications. If they need to be sandboxed, a liveCD with the ability to create a disk partition for storing stuff between reboots is alredy possible and fits the bill nicely.

    – Chris

  7. “I think it’s important to introduce kids to software freedom – that is, the freedom to hack on, change and improve your environment. You can’t get that using tools on Windows.”

    And as I’ve already said, one must learn to walk before they run. Changing someone’s entire OS and throwing everything they’ve learnt so far out the window – just because you want them to type some text into a text editor is not freedom. Freedom is choice. Teach a person to program and they will *Choose* linux. Force it upon them and they will never choose it.

    If there was any langauge that destroyed people’s minds beyond repair it’s not BASIC. At least with basic people keep a grip on reality and who Real People® are. Hardcore hackers, through a convulated insane langauge, lose all ability to relate to people who don’t understand it. How many times have I heard “If you don’t like it, fix it yourself”, “If you don’t like it, don’t use it”, “Just use grep, it’s far better than Spotlight”, “Installing apps in linux is easy”… :| It is this constantly closed mind that prevents linux getting anywhere in the desktop market and I do NOT have a closed minded just because I use windows, I am sick to my back teeth of hearing it.

  8. Chris C: Where’s the fib? It wasn’t free until recently – check. You’d need to get their permission to ship it with the book – check (unless you know different?). It’s crippleware – check. Read the details – you don’t even get the IDE. Learning to program shouldn’t require Makefile hacking as a first step.

  9. You could always teach them scheme. Which would not only get them completely out of the C/Java/Basic world, but start to teach them good programing practices at an early age. Not only that but scheme is rediculously simple, so you don’t have to spend all that time explaining syntax to them and trying to explain all the quirks of the bigger languages. The ammount of easy to understand documentation for scheme is terrific as it was designed to be easily accessible to all sorts of people. Yet Scheme also scales well, and can become increasingly more powerful as the student learns more.

    I don’t know… I’ve recently started delving into scheme and I have to say it’s a mind bender at first but it does some thing very eligantly and I think it would be really easy to teach kids how to use it to do intersting things.

    (not to mention it being FOSS, coming with a very decent IDE, and in general being kind of fun).

    ~Anders

  10. Is this an old article? I am in my mid-30’s and I was taught BASIC & LOGO on Apple II machines of varying stripes (the original, plus, e, c, etc.). The programmed in these languages long ago and I think it helped me,not hindered me.

    In Christ,
    Deacon Nikolai

  11. I think you’re all oversimplfying teaching a language to a kid with hindsight bias.

    Start them on BASIC, if they’re interested, quickly move them to something else (python or ruby).

  12. Gerv: Mono has a free C# compiler… You may not think it �counts� because Microsoft is in control of the language, but it�s there… And what�s most important isn�t the language, really, it�s the APIs that are available, and how well they are documented. If you take away the .NET API, then C# is just another Java without its API. In the basics, all imperative programming languages are the same, and learning the exact details of one language when you know another is peanuts.

    Anyways, even though I like C#, it might just as well be Python or Basic or whatever other language. Garbage collection is important, because languages without are too complicated and too error-prone to successfully educate to a beginner, I think.

    Now, with regard to your mention of Dijkstra. Funny that you mention JavaScript as a supposedly �good� language to learn then. I�d say that the thing about Basic that Dijkstra complained about was amongst others the availability (and use) of the GOTO statement, and probably the lack of typing of variables. The first was particularly present in early Basic languages, but modern variants have all the control structures that you need without having to resort to GOTO. The second is a matter of taste, really. I like typed variables, it avoids mistakes, but neither Javascript nor Python (nor PHP) have them, so apparantly there is no real need. So, I think you�re taking his words quite a bit out of context.

    The OS really doesn�t matter, the languages you named are fairly OS-neutral and even C# is that, depending on the API you use. So given that, I really do not see why you bring up the topic of installing Linux at all.

    I do not think JavaScript is a good choice of language by the way, its API is way too limited in functionality and complex for a kid to successfully learn good programming practices. Not to mention the different browser incompatibilities. The kind of hacks you sometimes have to apply because of the language limitations are not setting a good example for kids who want to �hack�.

    All in all, I think you�re missing the point here, which is �to teach a kid to hack�, not �to make a kid use open source software for his hacking�. If you don�t get that right, any book will be a failure, because the kid will never learn to hack (give up/not understand/not be able to) when there are too many hurdles.

    A final thought, computers used to come with programming languages installed by default (usually Basic). In fact, the system they booted in was usually that programming language. Computer magazines published listings which did cool stuff. It was an environment which encouraged programming. I think it�s a shame that we lost that, and I�m very glad that I have grown up with an MSX home computer, and not the current PCs. Yes, a computer should be a tool, but it is great if it also encourages creativity.

    ~Grauw

    p.s. yes, I�d also avoid Perl, it�s ugly as hell, and it even confuses me :).

  13. You may be interested in http://www.usfirst.org/ , home of FIRST, “For Inspiration and Recognition of Science and Technology”. They’re working on getting kids interested in science and engineering and having some successes.

    (btw it’s NOT completely U.S.-focused despite the domain name).

  14. I hate to start a language war, but people claiming Perl’s ugly have probably been working with existing code written by sloppy or careless people.

    The main problem with Perl is that it LETS you write sloppy code, and when you do that, it indeed looks ugly. And there’s a fair number of Perl programmers out there that do the fastest thing possible to get the code written instead of writing it in a readable way.

    Perl also lets you write incredibly clean self-documenting object-oriented code that’s so easy to follow that someone who’s never seen the language before can figure out exactly what it’s doing just looking at it.

    When you teach it to kids, you want to make sure you teach them the latter way.

    However, one of the reasons Perl has succeeded so well as a scripting language is that it does LET you make a lot of shortcuts, which when you’re in a rush situation to produce a script that’ll clean up after a mess on your server or somesuch, lets you get that script written in a hurry (although it’ll indeed be a bit ugly when you do it that way).

    I’m also a big fan of Python… Python and Perl are fairly close in capabilities these days, but Python enforces the readability aspect of the code down to the amount of indent on each line. For this reason (similar to how Pascal used to be viewed back when I was in college), Python is a really good starter language because you have to learn the structure aspect in order for it to work at all. Unlike Pascal (someone will probably shoot me for saying that though), Python can also do complex applications with the best of them. But once you have that structure down, there’s no reason to be afraid of Perl.

    Back to the topic at hand, I have younguns at home who are starting to show an interest in doing more than surfing and gaming with the computer. I’d really love to have such a book. :)

  15. Dave Miller: I�m referring to language constructs like accepting parameters in functions with $-signs, etc. Yes, you can do it otherwise as well, but the fact that it is at all possible and that many people use it… bleh. It�s like the presence of goto in Basic: it�s bad, and it�s there, so it�s used.

    Doesn�t mean you can�t educate people to not use those constructs, of course.

    Of Basic, there are many different versions of it by different manufacturers, so there are probably a number of variants out there already which have completely eliminated goto :). But there is only one variant of Perl, and it can�t be changed so easily (of course, this might just as well be an advantage :)).

    With regard to Python, I never used it, but I�ve heard a lot of good things about it.

    ~Grauw

  16. Great idea! And I think you should stick with that title if you’re going to be incorporating hacker culture, not just programming techniques. “Hacking for Kids” as a title would get a lot of attention, too. ;) Just put the hacker definition from FOLDOC on the back cover, and it should be ok (and educational!). :P

  17. Learning to program shouldn’t require Makefile hacking as a first step.

    Absolutely not, but IDEs aren’t good teaching tools and greatly increase the height of the initial hurdle. (Check out Eclipse’s Hello World tutorial, for instance.) If you want to avoid the hit-a-button, google-for-the-next-bit mindset it makes sense to use an interpreted language in a simpler development environment. The Python interpreter is a great replacement for a C64.

    – Chris

  18. I am suprised that no one has mentioned processing. It is basically a java library, but it come with a really stripped down IDE (they call it a sketchbook) that is dirt simple stupid (press the run button to compile).

    I had only previously played around with basic and taken a class in visual basic in highschool, but after learning processing, I have since taken a class in java and taught myself ruby. It was a really good way to get started for me.

    The important part is not really the language that you learn first, but rather that you are engaged and connected with what you are doing. Things like makefiles can certainly get in the way of that.

  19. Well, unlike Grauw, I think JavaScript is an obvious choice for something like this, particularly if presented with an emphasis on good programming practices. It’s an open standard; it’s well-documented; it provides a readily available, cross-platform, protected programming environment; there is a wealth of examples available to the novice – essentially, the entire internet is a source code archive; any number of editors support the language; it allows for a natural progression of programming sophistication – from simple procedural scripting to object-oriented development; and possibly most important, you can “do stuff”, cool stuff with visible results, immediately.

    Sure, there are browser incompatibilities, as Grauw points out, but is that any worse than the differences in the run-time libraries (where things generally get done) of other languages?

    Personally, I think that JavaScript is vastly underappreciated as a language.

  20. Gerv – I wrote my book “Computer Programming is Fun!” to teach teenagers programming with Python, on either Windows or Linux. The examples all use the free, cross-platform IDE that comes with Python. You might want to check it out. handysoftware.com/cpif/

  21. TEACH ME THE BASIC NEEDS OF HACKING ,I KNOW ONLY THE MEANING OF HACKING BUT NEVER KNEW ACTUALLY HOW IT GOES ON IN THE SENSE I SHOULD BE THOUGHT FROM THE MINIMUM BASICS HOW TO HACK?
    PLESE IF U DONT MIND GIVE ME UR EMAIL ID
    OR WEBSITE

  22. Hey, Just found this page while looking for help with my computer,
    I have been trying to find some kind of free tool for destroying the computers OS so I can reinstall it.I have W2000 and have no idea what I did but cannot get past the Login screan. I would be very greatful if somebody suggested something (ANYTHING!!!) I could download.I have even tried downloading something with any kind of virus that would eat the OS (still no succsess).
    My E-mail is : Frozeneden@hotmail.com
    Thank you so much.