Slashdot Mirror


The Value of BASIC As a First Programming Language

Mirk writes "Computer-science legend Edsger W. Dijkstra famously wrote: '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.' The Reinvigorated Programmer argues that the world is full of excellent programmers who cut their teeth on BASIC, and suggests it could even be because they started out with BASIC."

22 of 548 comments (clear)

  1. Good programmers aren't easily ruined by syousef · · Score: 5, Insightful

    A good programmer has experienced many languages and done things in many ways. A good programmer has compared all these various experiences and understands the advantages and disadvantages of each language and programming technique. A good programmer doesn't get bogged down in line numbers and GOTO statements and never move beyond that. If someone does get bogged down they never had the attitude to be a good programmer.

    --
    These posts express my own personal views, not those of my employer
    1. Re:Good programmers aren't easily ruined by Interoperable · · Score: 4, Interesting

      I learned in Fortran (I should qualify this by pointing out that I'm not a particularly good programmer) but it seems to me that writing logical code that uses GOTO statements would be a good introduction to computer logic. A complex program may become unreadable, but as a learning tool I could see that it might have merit. Good coding is about understanding logical procedure (and comments).

      --
      So if this is the future...where's my jet pack?
    2. Re:Good programmers aren't easily ruined by jpmorgan · · Score: 4, Informative

      Indeed. Dijkstra was frequently wrong, especially when he made grand sweeping statements.

      GOTO is a good example, 'GOTO considered harmful' is practically biblical law amongst many programmers, but it's worth remembering that he made that statement in the context of an argument with Donald Knuth. Knuth won: (http://pplab.snu.ac.kr/courses/adv_pl05/papers/p261-knuth.pdf)

    3. Re:Good programmers aren't easily ruined by syousef · · Score: 4, Insightful

      The irony is that under the covers, it's all done with jump instructions anyway.

      --
      These posts express my own personal views, not those of my employer
    4. Re:Good programmers aren't easily ruined by pedestrian+crossing · · Score: 4, Insightful

      I also started in Fortran and by the time I got through my second semester, I had an epiphany - highly structured code is very important if you are going to maintainably do anything of significant complexity. I don't think the language matters so much, once you get to a certain point you realize that you have to modularize your code if you are going to create anything beyond a simple classroom assignment. Languages like BASIC and PERL are great introductions for beginners because they are interpreted and present a low barrier to entry. The focus can be on basic programming concepts and they provide instant gratification. That said, if one is to go further and "become a programmer", you have to understand the need for structure, typing, scope etc. and take things to the next level. If you have the aptitude to be a good programmer, this will become clear to you as you take on more complex tasks. If you don't have the aptitude, well, you are going to be a shitty programmer no matter what language you started with. GOTO in a high-level language is bad in that it is a crutch that is tempting for the beginner to reach for, and overuse makes code difficult to maintain. Making a rule of avoiding it forces you to think through your flow/structure/logic.

      --
      A house divided against itself cannot stand.
    5. Re:Good programmers aren't easily ruined by AVee · · Score: 4, Informative

      If, and only if, you're programming in a language which doesn't provide any constructs to do error handling. Dijkstra was right, goto's are a bad idea and should not exist in a language. Knuth was right, in the absence of something replacing goto you're better of using it then not using (if done properly).

      All of that discussion is passed us now, most of us have been writing software without using goto for the last two decades, goto has been replaced with try/catch constructs, labeled breaks, switch statements etc. None of the examples Knuth provides in that paper are still relevant in any modern language. By that measure, Dijkstra won.

      It's not surprising either, Dijkstra was always in utopia, talking about how things would be if he build the world himself (which doesn't mean he's wrong). Knuth has always been about how to deal with the current reality (including the state of programming languages), and not so much about changing that reality.

    6. Re:Good programmers aren't easily ruined by RDW · · Score: 4, Funny

      "Your post pretty much proves Dijkstra's point. You did not manage to lay off your old thinking habits. You do not bother to think how an object oriented compiler works and to me it sounds that you are stuck in 80's style programming."

      'Object-oriented programming is an exceptionally bad idea which could only have originated in California.' - Dijkstra

  2. Fuck him. by OrangeCatholic · · Score: 4, Informative

    I was on Basic from 1986 to 1993, and it was the most meaningful years of my life.

  3. Simplicity by azgard · · Score: 4, Informative

    There's something to it. I recently downloaded a ZX Spectrum+ manual from worldofspectrum.org (the colorful one), and was amazed by how simple the language is. The complete reference takes like 10 pages? And it can draw lines and circles..

    Now compare it with any modern language, such as Java or Python. The language description itself takes 10x more than that, and the libraries available are vast. I am not arguing it's a bad thing; I am just arguing that simplicity may be a key here.

  4. Re:Second story from this blog this week... by gibbled · · Score: 5, Funny

    Clearly there's something fishy going on there...

  5. Funny argument by phantomfive · · Score: 4, Insightful

    His argument is kind of funny. He says people who've learned in BASIC have learned what NOT to do when programming. I have to admit he has a point....I learned exactly why spaghetti code was a bad idea after doing it for a couple years. Some people think they know what spaghetti code is, but unless they've written code with line numbers, they probably don't.

    --
    Qxe4
  6. BASIC is great for kids by VirtualUK · · Score: 4, Insightful

    I disagree with the premise that BASIC teaches bad habits. I stick with the old adage a bad workman blames his tools. BASIC teaches kids (like I was over 30 years ago) from the ages of 5-6 how to put together simple logic, and gives them the very basics of languages constructs like variables, loops, sub routines, etc. without them having to grasp structures, classes, polymorphism, OO, etc. that a lot of grown ups that have been involved with writing code for quite some time can have issues with.

  7. Re:BASIC is irrelevant by black3d · · Score: 5, Insightful

    Not recognising the relevance of BASIC as described in the article, it's possible you're around a decade or two younger than the individuals the article is referring to.

    --
    "The true measure of a person is how they act when they know they won't get caught." - DSRilk
  8. Appreciate the difference by Katatsumuri · · Score: 5, Insightful

    As a programmer who started with old-school BASIC (numbered lines, etc), I was overjoyed with better elements of structured programming in Turbo Basic, and totally excited with C when I learned it. It felt like having my hands untied. So I would state the contrary: you cannot fully appreciate the structured programming unless you went through the GOTO hell.

    I hear a lot of similar FUD from some people, like "you can't grok OOP if you started with C", or "anyone who touched .NET or Java is lost for C++..." It boils down to "people are idiots, they can't possibly learn anything new, they are either indoctrinated at birth in My True Way, or lost and hopeless." Who in their right mind would take that seriously?

  9. Variety by RenHoek · · Score: 4, Interesting

    I've gone from MSX Basic to Turbo Basic to Turbo C. Now I can code in all kinds of languages, assembly, PHP, Ruby, Javascript, etc..

    I do think that BASIC has value as a first language because it gives back results immediately. Sure, nowadays there are other script languages, so you don't have to go through compiling and all the other complexity. BASIC is valuable because it's just that: basic. You don't have to worry as a first-timer about libraries, include files, functions and everything else. You get down to the very basics like variables and program flow.

    And after a lot of years of BASIC programming I knew the limitations of the language (which largely depends on the interpreter). That's when I switched over to Turbo C. And to be honest it didn't took me long at all to learn C because I was a pretty reasonable BASIC programmer.

    What I _do_ object against is stuff like Visual Basic. That's taking a limited language which is simple and jamming it into a place where it shouldn't belong. To let Visual Basic work, they stuffed all kinds of non-original basic stuff in there which make it more complex then something like Visual C. Their idea was "lets make making real application easy with Basic, because Basic is easy right?". It doesn't work like that.

    I also think that Java is not a language that people should start programming in to be honest. Object oriented programming is NOT something people should learn before they had a taste of procedural programming. Fun fact. I went back to my old school to see about taking some night classes to get my CS degree. (I dropped out at the time and I've learned a LOT more on the job then what they were teaching.) At their open house classes I asked about procedural programming and if they still taught it. They scoffed and said nobody uses that anymore. This when I've been a Linux kernel developer for 10+ years now which is 100% procedural ANSI C. It's all Java they teach nowadays.

    In closing. I think a good programmer is somebody who explores. If I have a Windows application that does something cool, I take it through a disassembler to see what makes it tick. I look up DOT NET C# code snippets to see what it's all about. I look through COBOL and ALGOL source code to see what constructs people used in the past. I patch ARM assembly code to fix bugs. I do all those things and not rigidly stick to a single programming environment. A good programmer is a state of mind, not the language he works in.

  10. Bah by tsotha · · Score: 5, Insightful

    Computer-science legend Edsger W. Dijkstra famously wrote: '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'

    Like all eminently quotable people, Dijkstra tended to hyperbole and oversimplification.

  11. Easily gotten over by wrmrxxx · · Score: 5, Funny

    easy language first your get-over is

    FORTH started I at-all me affected not and

  12. Dijkstra ? Legend ? by vikingpower · · Score: 4, Informative

    Dijkstra, who taught at Eindhoven Technical University - which is how I superficially came to know him - was mostly a self-declared legend. He cultivated his own myth, even going as far as publishing a little book with his own quotes.

    --
    Religous speak to God. Insane are spoken to by God. When all shut up, one can finally hear Shostakovich in peace
  13. BBC BASIC by tomalpha · · Score: 4, Interesting

    I cut my teeth on BBC BASIC back in the 80's. It was simple, powerful, let you do pretty much anything and best of all came with a built in assembler. Now that was really neat.And it just worked. It was easy to optimise individual subroutines in assembler. This was age 10. At my simple state school with a couple of BBC Model Bs in the corner, I wasn't the only one doing that either.

    I make a living writing C++ now and seem to do fairly well at it. The kids coming out of university that I interview these days haven't touched BASIC, or C++ for that matter. We want them to write good C++ when they come and work for us. The intelligent ones adapt easily to working with pointers etc. The less able ones that have somehow made it through the interview process struggle.

  14. Re:BASIC is irrelevant by Eraesr · · Score: 4, Insightful

    At college we started off in Pascal but quickly moved on to C and a bit of Java. I'd say that if anyone is considering BASIC as a first language, they should choose Pascal instead. But to be completely honest, these days OO programming has become so important that it's probably better to start off in Java or C# from the start.

  15. Re:Second story from this blog this week... by geminidomino · · Score: 4, Funny

    Or, more on-topic:

    Haiku Overflow
    It was programmed in BASIC
    System halting now

  16. Point taken, but... by Moraelin · · Score: 5, Insightful

    Well it IS done with jump instructions, but as few as possible because the branch penalty is usually high (especially on an x86). If you don't use the goto statement then your program is more abstract, and structures like loops can be more easily optimised by the compiler to use as few branches as possible. Not to mention things architecture-specific like ARM's condition codes which can turn a loop with multiple if-else statements into a block of code with only one branch instruction.

    Point taken, but in my experience people who have even marginal idea of what happens under the covers, tend to write better code than those for whom the underlying machine is a complete mystery. I'm not talking premature optimization, but merely knowing in the back of your head what a pointer is, or _why_ this operation is O(log n) and better thus than O(n), can save one from a lot of awfully wrong guesses and writing awful code.

    My canonical example is a team whose architect (!) finally read somewhere that when passing an object to a Java method, only the pointer is passed on the string. So he actually decreed -- and none of the lemmings knew better -- that they should use parameters like the wrapper object Integer instead of the primitive int. (We're also talking Java 1.3 times, so no automatic boxing/unboxing either.) Because, I quote, "If you use Integer Java copies only a pointer to it, not the whole int."

    Maybe knowing how much space an int takes under the covers would have helped.

    Another time I hear my now ex-coleague Wally (not the real name, but pretty accurate;)) repeatedly going, "That can't be true!" and the like. Curiosity gets the better of me and I ask what's the problem.

    "Java has a bug!" he goes, "I put a new key/value with the same hash code in a HashMap and it just replaced my old value!"

    "Oh, yeah, we've had the same bug at the old company, " Wally 2 chimes in. "We had to manually set the capacity so it goes in another bucket."

    (I clench my teeth to avoid screaming at the notion that there's any way to the right capacity to avoid collisions for keys that are random strings.)

    I go and look at what he's doing, and sure enough he's got the debugger open and is looking at the bucket array of a HashMap. "Look! There! I had a different value and it replaced it!"

    "Aha, " I try to be diplomatic, "can you please expand that 'next' variable there?"

    "No, you don't understand! My value was there and now it replaced it!"

    "Yes, I get it. But I want to see what's in that 'next' variable."

    He clicks and goes, "Oh... there it is."

    The whole concept of a linked list was new to him, obviously.

    And if you think that's an isolated case, in the meantime I've run into two different teams whose "architect" actually made it mandatory to plaster his broken replacement for the hash-code method everywhere, because of that supposed "bug in Java." Supposedly they can hash a long-ish random String into a 32 bit int without ever having collisions. (Ok, 31 since Java doesn't use the sign.) Consulting can be depressing business, you know?

    I could go on with more such WTF examples, but basically let's just say I wish more people would know exactly what happens behind those high level constructs and libraries. Because otherwise I see them take their own guesses anyway, and guessing wrong. I wish they'd know what a pointer really means, and why a LinkedList does _not_ use less memory than an ArrayList, and, yes, what kind of things will cause jumps. Or what kind of things will be optimized into a tail recursion instead of a plain recursion, as a trivial example of where it pays to know the difference between a JUMP and a bunch of PUSHes and CALL generated by the compiler.

    --
    A polar bear is a cartesian bear after a coordinate transform.