My first computer language was PL/1, but soon after I learned, among other languages, Basic, and I really liked Basic and I still do. Basic is linear, and I think in linear constructs when I do any kind of computer program. This is probably, in part, because user interfaces are the last thing I want to deal with. I want a series of numbers to be treated in a certain way, or a set of formulas to generate a database. The most non-linear I tend to get is multidimensional arrays, and that’s still linear.

Python is potentially, and in practice, very different, and is essentially used as an object-oriented language. Yet at the same time it can be used in any other way, to reproduce pretty much any sort of programming paradigm. People thought of Basic as not very readable, but in fact, it was in its more advanced form if you programmed right. Python is said to enforce readability, if by readability we mean enforced indentation. People are still free to ruin readability in a number of other ways. But most importantly, Python holds a very important feature in common with Basic: It is interpreted. In other words, at any point in time while you are writing your Python program, you can “run” it and see how it is going.

The biggest difference between a language like Basic even at its high water mark some years ago, and Python is that Phython has plenty of modules for use do do all sorts of cool things. I’m not sure if the Python library is the biggest and vastest and most amazingest of all, but it probably is. So, if you are going to pick a programming language with paradigmatic flexibility, reasonable readability, and a powerful and diverse library of functionality, the Python is probably the way to go.

And therefore, you should teach it to your children. And this is where Python for Kids: A Playful Introduction to Programming by Jason Briggs comes in.

Officially…

Python for Kids is a lighthearted introduction to the Python programming language, full of fun examples and color illustrations. Jason Briggs begins with the basics of how to install Python and write simple commands. In bite-sized chapters, he explains essential programming concepts. And by the end of the book, kids have built simple games and created cool drawings with Python’s graphics library, Turtle. Each chapter closes with offbeat exercises that challenge the reader to put their newly acquired knowledge to the test.

The first thing that you need to know is this: If your computer has any sort of development environment set up on it, the instructions for installing Python provided in this book may be problematic or at least slightly difficult. I recommend using this book an an installation that is virtualized or simply a different computer than you otherwise develop on, not just so that your kid does not accidentally delete, or worse, alter and publish, your pet projects. Part of the process of modern programming, after all, is learning about the development environment.

There are a handful of good “learn to program in python” books out there and this one is similar; it is hard to know at which point someone using the book will pass from “Oh, I see, that’s easy” to “Huh?” which usually occurs a chapter or two after the person stopped paying attention to details. Python for Kids: A Playful Introduction to Programming does a good job of avoiding this problem by including a complete and rather extensive project, a game called the “Mr Sick Man Game” (which should be read “Mr. Stick-man game” and not “Mr. Stick… Mangame!”) There are plenty of other projects and individual programs that the book guides the reader through prior to the mangum stick opus. The book uses the “Turtle” module, based on LOGO, for much of this work. as well as the tkinter TH GUI toolkit interface. So if you don’t want your children near those modules, look for a different book, just in case you are involved in some sort of emacs-vim style code war.

Python for Kids is not available at this time but will be shipped in December, so this is a viable stocking stuffer option.

ADDDED: Have a look at this post on teaching your kid math using programming, via Python.

Comments

  1. #1 Martin Vethake
    November 24, 2012

    Started with 6502 assembly, went 68k and learned C. BASIC was that funny stuff people used to ‘program’ without knowing the ropes. Why not PERL? It’s all C anyway!? I _DID_ try Prolog, but philosophy isn’t on my charter… ;-)

  2. #2 Jonathan Mugan
    http://www.jonathanmugan.com/CuriosityCycle/
    November 24, 2012

    Very cool. I love Python. One disadvantage Python has for teaching is that it hides a lot of the processing underneath. For example, when teaching my child loops, it would be more instructive to use the GOTO and IF statements instead of a WHILE or FOR. But, regardless, Python is the language I use for teaching my kids.

  3. #3 Rick Wayne
    November 24, 2012

    Of course everyone has their favorite. Mine is Ruby, which I just like better because — well, it looks better! (Most arguments about programming tools eventually devolve to personal preference issues, I thought I’d just start there and save everyone the trouble.) I found Ruby more approachable than Python, with vast metaprogramming powers hidden just under the hood. Easy to learn, in other words, but also rich for the expert. Chris Pine’s Learn to Program would be the corresponding text for the aspiring Rubyist.

  4. #4 MadScientist
    November 24, 2012

    Prolog has those stupid dots just as COBOL does. Python must promote some brand of idiocy so they chose to use tabs to delineate functional blocks of code. I have numerous objections to the language design of Python so I stick to C++ and C for most work. Frankly I’m surprised anyone can write maintainable code in Python. Many colleagues prefer Python so I have to provide Python bindings, but in my opinion having to work with Python just makes my C++ code ugly. Why couldn’t people stick to Pascal – interfacing with C and C++ would have been so much easier then. Hell, I even prefer FORTRAN to Python (although Python makes some things such as GUIs much easier to access than in FORTRAN). Admittedly my first programming languages were Z80 assembly and 6502 assembly. I couldn’t afford a C compiler until many years later.

  5. #5 John Moeller
    Salt Lake City
    November 24, 2012

    @Jonathan M — I disagree with you (gently) about goto and if. I think that goto is great for those times when you want to do really low-level state-machine like programming (which is rare these days, or encapsulated and maintained by authors that know what they’re doing), and ifs should by and large be replaced by loop filters (which IIRC, Python has?).

    The next generation of programmers will be dealing with a large volume of data and they’ll need to understand filters and maps at an intuitive level.

  6. #6 John Moeller
    Salt Lake City
    November 24, 2012

    @MadScientist Look, over there! There’s a young Python programmer on your lawn! ;-)

  7. #7 Eric Lund
    November 25, 2012

    @Jonathan M: I will join John M in objecting to goto. The if statement has its uses, but many situations are better handled by for loops (if you know in advance how many times you need to repeat a block of code) or while loops (if you want to repeat a block of code as many times as needed before a certain condition becomes false). In the latter two cases you get a better idea of what the programmer had in mind.

    The problem with goto is that it can lead you absolutely anywhere. That makes the code significantly harder to understand, and there are few situations (indeed, I have never encountered one myself) where you gain enough speed or simplicity to make that tradeoff worth while.

  8. #8 MadScientist
    November 25, 2012

    @John: People can use whatever language they want – but for me C++ is really one of the easiest to maintain. With the fast computers and compilers available in the past 10 years I just don’t see much of an advantage to scripting languages anymore. For medium to complex projects, relying on a language design like Python’s is insane. Aside from maintainability, Python also makes it extremely difficult to accomplish some trivial tasks. For me, even Ada is preferable. :P~

  9. #9 DrSpiv
    Batcave, Fl
    November 25, 2012

    Damn Greg, I’ve probably been reading your blog for 5-6 years and I still have the urge to edit your typos.

    Also thanks for the review. I want to reach kids perl, but I realize that is cruel.

  10. #10 DrSpiv
    November 25, 2012

    And there I go with a typo. That was basically guaranteed by fate.

  11. #11 John Moeller
    Salt Lake City
    November 25, 2012

    @MadScientist — I sympathize with you, I just had to give you a hard time. :-D I agree with you about C++ as it turns out. I’m quite accustomed to it, don’t find it at all hard to program in, find it to be very powerful, and as you say, find it to scale very well to large projects.

    Trying to tell a younger programmer that a project is in C++, however, can be much like telling them that they need to eat fiber, and the reaction is about as obnoxious too.

    I don’t think that the reaction is *wrong* per se, as python is great for small projects. It will get better for large ones over time I think, as it’s still in the phase where it can move easily. C++ on the other hand, took well over a decade to give us language and library constructs that were desperately needed a long time ago.

  12. #12 Rober J.
    November 26, 2012

    Let’s see, with 6502 asm, Basic, Lisp, Fortran 77,Cobal, Perl, RPL, APL under the belt (forget C or C++ for personal reasons) Python might be worth a try, but I do agree also that Ruby has tempted me.

  13. #13 Mal Adapted
    November 26, 2012

    I wrote exactly one Prolog program, for a class in Logic Programming. I implemented a dichotomous key for identifying tree species. At the time (late 1980s), Prolog may have been uniquely suited for that kind of problem. I did rather poorly in the class (there was a lot going on in my life just then), but my program got an A.

  14. [...] Read more… Share this:Google +1TwitterLinkedInFacebookMorePinterestRedditLike this:LikeBe the first to like this. This entry was posted in resources. Bookmark the permalink. ← Play YouTube videos with VLC [...]

  15. #15 linux
    http://knopka.kh.ua/linux/
    November 27, 2012

    Конечно, каждый имеет свои предпочтения. Мое-Рубин, я просто, как лучше, потому что – ну, она выглядит лучше! (Большинство аргументов об средств программирования, в конце концов, переходят к личным предпочтениям вопросы, я думал, что я просто начала там и спасти всех от неприятностей.) Я нашел Ruby более доступным, чем Python, с огромными метапрограммирования силы скрыты именно под капотом. Просто, чтобы узнать, в других словах, но и богатых и для эксперта. Крис Пайн Научиться программировать будет соответствующий текст для честолюбивых Rubyist.

  16. #16 Greg Laden
    November 28, 2012

    Translation: “Of course, everyone has their own preferences. My-Rubin, I’m just the best, because – well, it looks better! (Most of the arguments about the development tools, in the end, go down to personal preference questions, I thought I’d just start there and save everyone the trouble.) I found Ruby more affordable than Python, with enormous power of metaprogramming is hidden under the hood. Easy to learn, in other words, but the rich and for the expert. Chris Pine will learn to program the text for the aspiring Rubyist.”

  17. #17 Francois Dion
    North Carolina, USA
    November 28, 2012

    I started on a similar thread on my blog earlier this year:

    http://raspberry-python.blogspot.com/2012/09/logo-turtle-graphics.html

    I think an excellent solution to teach children programming is a combination of Python and the Raspberry Pi. That way you dont have to worry about loosing anything important. It is the child’s computer. Of course you might want to grab more than one, because they are just plain cool to play with.

    Just look at Broadcom’s MASTERS:
    http://blog.broadcom.com/broadcom-foundation/broadcom-masters-finalists-get-a-taste-of-raspberry-pi/

    Kids writing games before the afternoon is over.

  18. #18 Jonathan Mugan
    www.jonathanmugan.com
    December 1, 2012

    Great discussion here! The GOTO is not so that kids can learn to use it, but rather so kids can learn the step-by-step flow of a program. But yeah, they are considered harmful :)

  19. #19 John Moeller
    Salt Lake City
    December 1, 2012

    @Francois — that’s a really cool idea!

    @Jonathan — actually I don’t think that GOTO is harmful, at least any more than some of the leaky abstractions out there.

    For example, I think that you could claim, on one hand, that GC is harmful because it leads a programmer to think that any resource will be cleaned up automatically, even the ones not covered by GC (like sockets). On the other hand, it’s really convenient (and cleaner) not to have to worry about the objects you build.

    GOTO is like this for me. It’s a powerful abstraction, but it can be misused.

  20. #20 Leon
    Finland
    December 1, 2012

    I’ve started my 9 year old out on HTML, CSS and finally JavaScript. You would think it would be a bit bewildering having all three (and I’ll probably throw jQuery into the mix after a while), but he seems to be taking it much better than my attempt at teaching him python.
    Part of the success has been the environment. We’ve been using jsBin http://jsbin.com/ where you separate code areas and see results in real time.
    I’ve recently been learning Java, and think its over verboseness makes it well suitable for educational purposes. Once he gets a good grasp of JS and web programming, I’ll see how he takes to it.

  21. #21 Donald 'Paddy' McCarthy
    United Kingdom
    December 2, 2012

    @MadScientist.Your name … :-)
    I guess I think your wrong about C++ being a great language for the new programmer. It is too much work and too much to learn before any reward to a child. Too much to learn, (or be told to ignore), between “Hello world” and done.

    Compare http://rosettacode.org/wiki/Hello_world#C.2B.2B and http://rosettacode.org/wiki/Hello_world#Python

  22. #22 Tim Rowledge
    December 5, 2012

    “If you think C++ is not overly complicated, just what is a protected abstract virtual base pure virtual private destructor and when was the last time you needed one? ”
    See http://coding.derkeiler.com/Archive/General/comp.arch.embedded/2004-02/1060.html for more.

  23. #23 John Moeller
    Salt Lake City
    December 5, 2012

    @Tim — yep, C++ hate, blah blah blah. Somehow it’s still around and widely used. Hmm.

  24. #24 Edward Welbourne
    Oslo
    January 9, 2013

    It’s easy to be nostalgic about your first language (BASIC was mine), but I’d have to grant that (even if he does overstate the case) Dijkstra had a point: “It is practically impossible to teach good programming style to students that have had prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” [SIGPLAN Notices, Volume 17, Number 5].

    In particular, GOTO (and tendency to label every statement regardless of whether it’s the destination of any actual GOTO) is a hideously amorphous mechanism. I once had the fun exercise of making sense of some ugly FORTRAN that made extensive use of GOTO and, in the process, fully illustrated the biggest problem with it: at any given line of code, you have very little idea of where you just arrived from or what state your variables might all be in. There are strong and good reasons behind the early consensus that structured programming is a far better way to write the code: branching, looping and calling functions (with local variables, on a stack, to permit recursion) in well-defined ways, so that the flow of control through code can be faithfully represented by a straightforward flow-chart.

    In particular, because structured programming makes it possible to see clearly what’s going on (even to prove theorems about how the things true at one point in the code imply things that shall be true at another), it makes it much easier for someone unfamiliar with the code to make sense of it (without, as I had to for the FORTRAN I mentioned above, printing it all out and finding dozens of distinguishable pencils and pens with which to draw in arrows indicating the flow of control). Intelligibility to the newcomer (or the original author, long enough later that they’ve forgotten the details) is essential for maintainability.

    Anyone hung up on the choice between delimiting control blocks with braces or BEGIN…END vs indenting them clearly does not have the flexible brain I consider essential in a good programmer. The parser’s going to turn the code into a tree structure in an entirely predictable way; it really doesn’t matter what lexical convention you use, once you get used to it, as long as you can think in terms of that tree structure; so the language designer reasonably can (as Guido did) ignore what experienced programmers are used to in favour of what makes the language more accessible to the total newcomer, unfamiliar with programming in any form. Guido opted for indentation; I found it a bit weird for about five minutes, then it became as utterly natural as braces and the other idioms I’m used to.

    I’m not sure what MadScientist’s beef with python is, as regards maintainability, but I’ve seen a great deal of code over the last thirty years and my impression is that python makes is much more natural to write reasonably maintainable code. Some languages pretty much seduce abysmally unmaintainable code (perl is the prime example: it’s entirely possible to write maintainable perl, but most of what I’ve inherited of it has been monstrous, until cleaned up) and you can write unmaintainable code in any language (especially if you’re well-versed in some other language and too busy shoe-horing its idioms into some other language to learn the latter and work with its idioms instead), but my experience of what others have written and how easy it’s been to pick up and work with all favours python strongly. I learned the language on a pile of code a departing colleague had written hastily in his last four months; he hadn’t done a (terrible or) brilliant job of it, but I had no trouble making sense of it and beating it into working shape, despite being new to the language myself. That’s a pretty good testament, all on its own, to python being quite good both for maintainability and for ease of learning.

    [If the problem is that you have to create python bindings for you C/C++ code, check out SWIG; it'll automate that stuff for you, building bridges between quite a few languages.]

    All things considered, I think python is an excellent choice of first language to teach to kids – it introduces all the sound structural elements in straightforward ways, while having room to advance to high levels of sophistication – but I wouldn’t describe it as “The New BASIC”, precisely because I wouldn’t describe BASIC as a good choice of language to teach to kids. Some of us survived such an initiation and even went on to learn better and more powerful languages; but I’m inclined to say we did so in spite of starting in BASIC, not thanks to it !

    I should also emphasise that it’s a good *first* language: no-one learning to program should remain monolingual for long – I don’t care how good your first language is, the insights you can gain from playing with others are important too. All of the other languages I’ve seen mentioned above (yes, even BASIC) have lessons to teach and some of them are far better suited to certain tasks. Still, starting with python won’t cripple anybody’s ability to learn the others and will give them a good foundation on top of which to build their understanding of other languages as they come to them.

    Equally, it’s merely *a* good first language: ruby’s another (I’d agree that Chris Pine’s book is a good introduction to programming) and there are surely plenty more. Still, it *is* a good first language and there are several good tutorials that make the most of that.

  25. #25 Greg Laden
    January 9, 2013

    You make good points, but I do want to correct you on one thing. I’m not a programmer but I’ve programmed a fair amount (for a non programmer) in research I’ve done. A lot of that was in Basic, and never once did I ever use a goto statement, and the use of the goto statement is something that was discouraged at one point in Basic programming, so that one problem really isn’t an issue.

    The issue I have with programing languages is that as GUI’s became more important and object oriented programming became the thing to do, writing a simple procedure (using that term generically) to manipulate or crunch a bunch of data i one file and spit it out into a different file has become, well, not really worth the effort. If I want to do that sort of thing now, I just use a spreadsheet, a bash script, or r. For the most part programming languages are no longer of use to me. The vast majority of the code I need to run consists of simple transformations of numbers and almost nothing else.

    I looked into basic a couple of years ago for a project because I had code already written, and found most basic compilers/interpreters to be no longer supported or transformed into elaborate OOP languages. More recently, I think some have come back.

  26. #26 Edward Welbourne
    Oslo
    January 27, 2013

    If you were writing BASIC without using GOTO, I must presume the language had evolved a good bit since I last used it ! That being so, I’m happy to know it; and I probably wouldn’t recognise that it even *is* basic, if I saw a sample of code in it. None the less, I’d generally chose python as the language in which to teach a newcomer to programming.

  27. #27 Greg Laden
    January 27, 2013

    Programming languages don’t make bad code. Programmers do.

  28. #28 #Python   « iandouglas.com
    September 9, 2013

    [...] Is Python The New Basic? (“Python For Kids”) My first computer language was PL/1, but soon after I learned, among other languages, Basic, and I really liked Basic and I still do. Basic is linear, and I think in linear constructs when I do any ki… [...]

  29. #29 Jason
    September 27, 2014

    There are a lot oof misinformation and lies being spread about BASIC. No, this article is wrong, like lots of others. BASIC IS STILL the best language. Modern BASICs can do ANYTHING that any other language can do, that is languages like C, C++, Java or Python.

    Here is a list of some modern BASIC languages:
    Visual BASIC, FreeBASIC, Power BASIC, Real BASIC, Blitz BASIC, Dark BASIC, Thin BASIC

    These are all greatly enhanced supersets of the BASICs of the 1980s to which all of the fear mongers against BASIC refer to . All of these are fantastic to program in and some of them have great libraries that allow complete manipulation of the development hardware just like C. Sure a couple of them may not be object oriented, but fuck object orientation, that’s the quickest way to not learn programming. Procedural programming is still the best for single to small programming groups. Objects are mostly beneficial for GUI and graphical manipulations, everything else can still be done easily and more simply using records, user types and arrays.
    With Python, ifs absolutely stupid to depend on invisible space as block delimiters.

    Python if block:
    IF condition:
    do something
    <– this space is the end of the block
    other code….

    BASIC if then block:
    IF condition THEN
    do something
    END IF , there was a good chance it wouldn’t work.

    Python 2.7 Print is a statement
    print “Hello World”

    Python 3.0> Print suddenly is a function
    print(“Hello World”)

    NO, Python is NOT the new BASIC,
    MODERN BASIC is the new BASIC.

  30. #30 Greg Laden
    September 27, 2014

    So what is the best BASIC implementation then, of all of those?

    ” fuck object orientation, that’s the quickest way to not learn programming. Procedural programming is still the best for single to small programming groups”

    I tend to agree!

  31. #31 Jason
    September 30, 2014

    Hello Greg

    Yes BASIC is still the best. Now, the best BASIC?
    They all have their pros and cons and it also depends what you are trying to achieve.

    Visual BASIC: ($800+ sold as part of Visual Studio .net)
    If you want to make 100% professional/commercial Windows applications including web applications. Also, you can make full use of the Microsoft MSDN library which is like a large, huge, massive… help file. Is free to learn but costs money to create and sell.

    PowerBASIC: ($200)
    Has the fastest 100% machine code to BASIC compiler and according to many articles is the fastest compiled BASIC version for Windows. Can create Windows GUI objects.

    RealBASIC: (Now called Xojo) ($300 – $1000+)
    Similar to PowerBASIC but costs money and is expensive compared to PowerBASIC eg: Standard version costs $300, Various controls and addins bump prices closer to $1000. Can create Windows GUI objects.

    Bliz BASIC: ($0-$100)
    Costs money (up to $100) but its reasonable and a one off payment unlike the Visual BASIC and RealBASIC where every PC installed on needs a new purchase. Blitz BASIC is geared more towards games programming and there are different versions. (Blitz MAX and Blitz3D) (Bltiz3D an older version but still very usable is now free). Caveat can only do DirectX which means 3D is possible on only Windows PC. Blitz Max can output for Mac and PC as well.

    DarkBASIC ($40)
    This BASIC is also geared towards games programming and is Windows only and DirectX only. Also, this BASIC is closer to the older BASIC’s of the 80’s due to less sophisticated language constructs.

    FreeBASIC (Free)
    An excellent version of modern BASIC. Has many free libraries to carry out any task imaginable. Can also create Windows GUI applications. A bit tricky to setup due to the need to add an editor to actually edit any code (and also install libraries). FBEditor is good.

    ThinBASIC: (Free)
    A comprehensive and fantastic BASIC but… it is interpreted. But can still produce very impressive Windows (another caveat, Windows only) applications including DirectX games (try the examples).

    There are other BASICs available too such as GLBASIC, BASIC4GL (if you want to do OpenGL games programming, GLBASIC is quite primitive, but multi platform). MonkeyX.

    Try these and I think you will find Python has no advantage except hype.

    Well one clear advantage of Python is in web programming where your web hosting company may be able to run python scripts. But, then again, it is a 100% guarantee that you will be able to run ASP (a subset of Visual BASIC) scripts on any Windows hosting provider.

  32. #32 Greg Laden
    September 30, 2014

    I am not very big on Windows. Mainly Linux here.

  33. #33 Jason
    September 30, 2014

    Ok then, FreeBASIC will work on Linux and there is also Gambas. Gambas is like Visual Basic for Linux. Gambas should install easily from Synaptic or apt-get, but, FreeBASIC is much trickier. You need the correct dependencies to get it working. I am disappointed with the situation with BASIC on Linux (ie:limted compared to Windows). Also. do note that some of the Windows BASICs can produce executables that run on Linux.

  34. #34 Greg Laden
    September 30, 2014

    Yeah, I could not get FreeBasic to run on my Debian distro … a dependency problem that seems to be a dead end for others as well, at the moment. Gambas is nice (I’ve used it, but not in a long time). To be honest, the best basic for me, given my specific needs, would be qbacis or quick basic … not OO, really like a scripting language. Interpreted vs. compiled probably does not matter much.

  35. #35 Jason
    September 30, 2014

    Yep, QB is nice and with QB64 more versatile. Unfortunately, these are limited to Windows. They might work using WINE but likely some bits would fail to work properly in that environment.
    Another possibility, if you want to do web programming is ASP scripting with Windows hosting. And finally, yes, for your specific situation (ie: Linux development platform), Python IS more of an option given the limited versions of BASIC available on Linux and extensive support for Python.

  36. #36 Christopher Winter
    September 30, 2014

    Somewhat OT, but maybe of interest:

    Announcing: Time, Clock, and Calendar Programming In C
    Posted on 2014-09-29 by Eric Raymond

  37. #37 Greg Laden
    September 30, 2014

    I only do text processing and numerical processing, mainly cleaning up data sets (for use in a stats program) or automating some writing tasks, that sort of thing.

  38. #38 Jason
    September 30, 2014

    I think Python could handle that fine. There is a Python library, numpy, specifically for working with large numerical numbers with high precision. Another thing you could possibly investigate is Perl and PHP. These could also do all your processing AND present the data onto a webpage using procedural coding.

Current ye@r *