Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Education Programming

Why Teach Programming With BASIC? 709

chromatic writes "To answer the perennial question 'How can we teach kids how to program?', we created a web-based programming environment. As we began to write lessons and examples, we surprised ourselves. Modern languages may be powerful and useful for writing real programs, but BASIC and Logo are great languages for demonstrating the joy of programming."
This discussion has been archived. No new comments can be posted.

Why Teach Programming With BASIC?

Comments Filter:
  • by gstrickler ( 920733 ) on Tuesday December 28, 2010 @09:31PM (#34693932)

    My first language was BASIC, my second assembler. Since then, I've learned at least 6 more languages, but I still prefer a modern compiled BASIC for most projects. On the rare occasion that BASIC can't deliver sufficient performance, I'll link in some assembly or C routines. I've been quite successful doing that professionally for almost 26 years. That doesn't mean I always write in BASIC, I use the language that best fits the needs, the majority of the time, that has been BASIC.

    Mind you, I hate old interpretive BASIC languages that require line numbers, don't have DO/LOOP, WHILE/WEND, Sub/Proc/Function calls, variable scope controls, and other necessities. I'm talking about modern compiled BASIC languages with most of the modern structures we all know and love. It's not a perfect language, but it allows me do code, debug, and modify far faster than any other language, and for most purposes, performance is close to any modern language.

  • by underqualified ( 1318035 ) on Tuesday December 28, 2010 @09:40PM (#34693996)

    the correct question would be...

    how do we get our kids interested in learning how to program?

    and the answer to that would be...

    tell them they're not allowed to do it.

  • by QuoteMstr ( 55051 ) <dan.colascione@gmail.com> on Tuesday December 28, 2010 @09:55PM (#34694120)

    When teaching students how to program (which is entirely different from teaching them computer science), you should begin with the most fundamental concepts: talk about raw memory and opcodes. Discuss briefly how these instructions are actually interpreted and implemented (how a half-adder [wikimedia.org] works is fascinating, even if most people never have to build one in real life).

    Once your students understand how to make computers do basic things with raw instructions, teach them jumps, conditionals, loops, and even subroutines. After that, introduce higher-level languages and compilers, and demonstrate that the compiler merely automates what your students have already been doing. From there, teach progressively higher-level constructs, including second-order function references, data structures, and so on. Object-orientation falls out naturally once you get to structures and function pointers.

    If you follow this approach, your students will have an understanding of the entire abstraction hierarchy, which is not only of immensely practical value, but also underscores the principle that nothing in this field is "magical". You can always pierce an abstraction, and even more importantly, erect new abstractions where appropriate. The most common flaw I find in programmers is the inability or unwillingness to build new abstractions. The only way we make progress in this field is by the old reductionist approach of breaking a hard problem into smaller parts and attacking each individually. When you teach your students how to do that by demonstrating the power of abstraction, you make them better programmers.

    Programmers shown UML, Java class graphs, and so on right away become too familiar with that level of abstraction. They think of lower levels as some kind of magic and don't realize they can and should build their own levels on top of what they're given. The result is often incoherent, rambling, brittle, and ugly code. Don't let that happen.

  • by narcc ( 412956 ) on Wednesday December 29, 2010 @01:47AM (#34695606) Journal

    Programming should NEVER begin with OO. If for no other reason than the cruft you need to add in OO languages before you can even begin to introducing basic concepts.

    Objects are great when used appropriately. However, knowing how and when to use objects takes experience. Beginners by definition don't have experience.

    "Pure" OO languages are even worse. When everything is an object, you don't have a choice about when to use them and, consequently, are much more likely to use them inappropriately. (Bad OO code makes you wish you were maintaining bad VB code!)

    Sure, a good programmer can write great OO code, but such programmers are extremely rare -- You're not likely to find an introductory class full of competent and experienced OO programmers.

    Having taught programming to many different age groups (from children to adults) I know from experience that OO is not the way to go. You can't just start off with structure -- it's totally inappropriate. They simply can't learn to structure their code until they're capable of writing some!

    Teaching someone programming is a bit like teaching someone to think. A good teaching language should let you introduce all the basic concepts like direct sequencing, bounded and conditional iteration, conditional branching, variables and types, i/o, etc. without a bunch of indecipherable code cluttering up the program and confusing the student ("magic" just-ignore-this code does not aid in the learning process).

    For that, the submitter is spot-on. Languages like BASIC and Logo are excellent introductory languages. All meat and no fat. I prefer Logo for children under 10, BASIC for everyone else. I've tried Java, JavaScript, C, Pascal, and even COBOL. Nothing stays out of your way like BASIC or gives you the instant satisfaction (crucial to younger children) like Logo.

  • Re:Python vs. BASIC (Score:4, Interesting)

    by fyngyrz ( 762201 ) on Wednesday December 29, 2010 @01:59AM (#34695660) Homepage Journal

    A program shouldn't treat block structure or typos as run-time errors.

    Wrong. A language that actually uses whitespace should. Which is what Python does. The fact that you can't wrap your head around it isn't in any way a condemnation of Python. It just says you're inflexible, and frankly, in forty years of programming experience, I've never found lack of flexibility to be a useful trait.

    Whitespace utilization in Python uses the programmer's intuition to instantly perceive block structure. This beats the heck out of scanning lines for randomly embedded (speaking spatially, now) braces. Mind you, it is possible to write C (and I do), for instance, nominally a free form language WRT whitespace, with meaningful whitespace. Really helps, especially later on, when you haven't seen the code for years.

    The fact that Python *requires* whitespace is simply a means to bring your intuition to the table by force, and frankly, I think it's a good idea. That some folks can't, or won't, get it... that's unfortunate. For them. :)

  • Re:Scratch (Score:2, Interesting)

    by Anonymous Coward on Wednesday December 29, 2010 @11:20AM (#34698584)

    Second this. Scratch IS for the current generation what basic was to us. It is simple enough for a four-year-old to understand (and actually make functional games with), and yet deep enough to do real time ray tracing (for sufficient relaxed definitions of real time). Anyone who has not tried scratch needs to do so. RIGHT NOW. No there is not a web based application, but it does run on LINUX, and features the ability to convert your creation to java and upload them to the scratch website.

All the simple programs have been written.

Working...