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."
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.
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).
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.
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)
Absolutely. It was drummed into me (and apparently most coworkers), and I can't believe how liberating it is once you realize, yes, in appropriate contexts "goto" can result in code (especially in error handling cases) that is both more readable and more efficient. Dogma is rarely the answer.
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.
receive(id, val) previousId = id previousVal = val beforeEOF = true while (beforeEOF)
beforeEOF = receive(id, val)
if(not beforeEOF || id <> previousID)
output previousId, previousVal
else
previousId = id
previousVal = val
end if end while
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.
I'd argue that goto IS harmful - however like all harmful things, there are use-cases where it is either necessary or useful to accomplish a particular objective.
Much like a chain saw not being an all purpose cutting tool....
So... avoid using it when not strictly necessary, but if it is the only sane/high performance way of getting things done in a special use case, by all means...
I too started out with a range of BASIC varieties. I coded on Commodore PET and 64, AppleII and Color Computer and all sorts of thing like those. I then moved on to Assembly language for Motorola processors. Those two language experiences have the lacking of something in common -- functions; creating them, linking to libraries and all that. This meant I learned to do it ALL myself, whatever it was, and my code wasn't all that portable except for copy, rename and modify to suit. Everything was GOTO, GOSU
"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
Commodore Basic taught me to love programming, have fun making little games and all important binary operations and encoding for sprites and font QBasic allowed me to take my learned lessons to the 8086 and add much much more visually appealing graphical interfaces (still mostly games, but also editors etc.) QuickBasic introduced me to libraries and compilation, i've built some great hardware monitoring interfaces with sensors and relay switches Visual Basic allowed me to explore the win32 API and libraries, i''ve built some of my greatest applications with it ranging from editors and filtering proxies to a graphical music collection interface I could control with a remote
I loved basic, it taught me so much but most of all it taught me to love programming... The days of fun little programs in basic are over and I have no intention of ever going back... but there is definitely meaning there, and I would recommend anyone to try programming with basic... as a self-taught programmer I can say you will learn a lot from basic.
Commodore Basic taught me to love programming, have fun making little games and all important binary operations and encoding for sprites and font
Preach it. My first exposure to binary was working through the examples in the Commodore 64 Programmers Reference Guide [commodore.ca] (still the best manual I've ever read). Sprites were 8x8 images stored as a 8 bytes, each byte representing a row, and each bit representing a pixel. I probably went through that section 15 times before I truly understood and believed that binary math works, but the lesson paid off in spades. Back then, it was figuring out how to peek and poke a memory location to make a single pixel blink. Now it's loading and storing a memory location to toggle a serial control line on an embedded controller. That little machine gave me a good start.
Depends on the BASIC. I use RealBasic at work as an alternative to LabView. It's object oriented, multithreaded and completely "Visual".
as potential programmers they are mentally mutilated beyond hope of regeneration
Am I the only person on the Earth who just writes off hysterical, panty-wetting stuff like this? When did he say this? in the 1960s or something? It's 2010 now, right?
It's Dijkstra we're talking about. And Dijkstra does have quite a few genuinely useful and lasting achievements speaking for him (semaphores and such), while Wirth was indeed, more or less, a quiche-eater.
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.
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.
That is totally true, I remember the first time I saw structured programming, it was something simple, just an easy way to print a list of items on the screen, and it was literally a feeling of the joy of discovery. I got addicted and started thinking up my own ways to structure code.
Compare that to the guy I met when I was tutoring CS, who said, "functions, why do I have to use functions to write this program? I know how to use functions, it's such a waste of time." The idiot could have finished the program in the time he spent complaining about it, but he certainly did not feel the joy of discovery.
Yeah, there were no 'else' constructs. If you wanted an else, you had to do it yourself with a couple GOTOs. Also, the worst part about line numbers was when you decided to add something later, and there weren't enough lines. A program that had been refactored this way a few times could literally move randomly through the source code.
I never owned a Beeb, though I had several friends that did. I used them at school a lot too, and their BASIC was extraordinarily advanced. The ELSE statement was there, as was the standar(ish) GOSUB, but you could also define true procedures which returned values etc. (DIM PROC), and there was a clean way of dropping down to the 'OS' proper (OSCLI statements).
In addition, it also solved the line number problem you mentioned. It had a renumber command so that everything would become properly spaced out again. I remember the style of coding you're describing from my C64 efforts - the C64 was actually MS BASIC and it was dreadful, anyone wanting to do decent high-levle coding used to get the Simon's BASIC [wikipedia.org] cartridge.
As a whole though, the BBC simply had the best BASIC of any 8-bit I encountered. That's not too surprising given its background and use as a teaching tool, but they did it very well indeed.
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.
I maintain that Python can do this much more easily due to the fact that there are simply fewer ridiculous syntax requirements in a simpler to read format. The things you learn in BASIC can be taught at a much more significant level in Python (inline AND block comments, order of instructions, basic control structures, variables and their use) without jumping through the hoops that you will in BASIC. Python's use of whitespace and extensibility allow beginners with an aptitude to expand on their knowledge ea
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?
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?
That quote reminds me of a number of religions who have exactly that attitude. Makes me suspect that it must be a recurrent (though no less foolish) theme to human thought...
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.
Years before I took any formal course, I was looking at the manual of a BASIC computer and making circles on the screen by programming a dot that kept to the same distance to another and rotated. I still remember the emotion of seeing a real circle emerge on screen. I don't know if BASIC helped me much to program, but the immediacy of the thing certainly did much to keep my interest alive.
I too started with BASIC. In my case this was freshmen year in High School back in 1999 on QBASIC. I had dabbled a little with HTML but that was nothing like an actual language that had logic. It was there that I learned the basic blocks that made me the programmer I am today. I went from simple logic to loops to graphics and sound.
By the end of the year I had a full animation of a house with Christmas lights and music. I even had a very primitive text based RPG working with the ending taken straight out of
Most folks who have learned C++ learned it in a classroom with a real teacher. Most folks who learned BASIC learned by banging away on a computer keyboard at home.
Most people aren't very good at teaching themselves. I've seen this a lot with people trying to learn Morse code and giving up in frustration.
You can pick up a lot of bad habits without someone to guide you.
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.
...but it was BASIC. And the expectations were so low. "10 PRINT "Hello, World!", "20 GOTO 10" and it started doing something. The programming manual was well worn by the time I was 10, would that have happened with any other language? I doubt it. Things like lack of scoping makes the easy things easier and the hard things harder. The point isn't to learn everything from your first language, the point is to get started and interested at all. Moving to DOS was sorta ok, but moving to Windows killed my interest. C/C++ was just horribly complicated, I remember trying to get up a window in the Win32 API and it was like wtf, how hard can this be? MFC was even worse, Java (really early java, on hardware of the time) was slow and unresponsive as fuck, Javascript was a toy language for websites and never really like Pascal or VB much either. I didn't regain my interest in programming until I went with C++/Qt, or maybe more Qt than C++ really. QMainWindow *mw = new QMainWindow(), mw->show(). The hard stuff is still hard, but I very very rarely find I write "overhead" code that I shouldn't have to.
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.
I think the author is mostly on. He's aware Dijkstra was exaggerating for effect, but also completely correct... if you started programming in the early home computing era, you probably started with a BASIC. I was lucky enough to get some varied exposure earlier to some other languages (LOGO and some shallow assembly), but until I was 15, it was pretty much Basic.
And none of my programming habits now resemble anything close to the BASIC I wrote in when I was that age. Except, occasionally, for the rare cases where global state seems to make sense, and even then, I try to namespace things in one way or another. But by and large, I picked up structured programming, I picked up object-oriented programming, I picked up logic programming, and I'm learning to enjoy functional programming.
I will say... there was a time when I was probably close to being "ruined." It was when I was learning C++, and I only really had Pascal, basic C, and Basic under my belt. And I had a pretty solidly structured-imperative mindset, and really hadn't seen any other way of doing things. C++ married data structures and methods in an interesting way, but it didn't seem like more than a stylistic practice to me. I was pretty sure most languages were alike, you just had syntax and typing differences.
But there was one thing: I'd had to learn Prolog for a very specific job. We were teaching it to high school students in a CS summercamp I worked at for a few years. The first year, I just thought "Man, this is weird," more or less got through all the exercises, and left it behind, and did what most people do: dismiss it as an odd research toy. The second year, I thought "this is weird, but interesting." The third year, I thought "Wow. There are all kinds of intriguing ideas here."
And there are, and I still think it could stand to see more usage in mainstream software, but more importantly, I think I'm pretty lucky I got repeated exposure to a language that forced me to think differently before I got very far into actually working in the software industry.
Because I now think there's either a critical period [wikipedia.org] (or possibly, at a minimum, a critical attitude of some kind) after which a lot of programmers tend to lose either the humility or the curiosity that drives people to think about different programming constructs and habits. I think if a programmer has been minimally exposed before they reach it, they'll keep just enough of one or both of those attributes that they'll be interested in what they don't already know, rather than arriving at the point where "they've already learned the last programming language they'll ever need." [blogspot.com]
And if they don't get so exposed, they become Blub programmers [paulgraham.com], where generally $Blub is some industry-leading language that does enough you don't easily bump up against tasks that are near impossible in it.
To tie this back in with a point I think the author missed, I suspect that some of the difficulties with Basic are actually part of the reason why it didn't end up ruining more programmers. Almost everybody who really came to grips with it as a tool probably realized that it couldn't possibly be the last programming language you'd ever need (if it weren't enough that any effort to look into working as a programmer revealed that Basic was clearly not the strongest payroll ticket).
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.
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.
It's not necessarily a bad thing to have done things in BASIC, but bad habits can be formed by that language. However the other side of it is that if you first see the bad sides of BASIC then you can recognize the good sides of other languages.
When programming in Java, I still resist breaking out of loops, or multiple returns, even in small methods. These things seem to be normal acceptable practice with most developers, and really are fine when used in the right places. Because of early exposure to BASIC (and badly written C) I avoid them more than most.
I think the BASIC of today is Javascript. You see more badly written javascript than any other language..
Perl as introduction to programming for kids? You will be lucky if they put you in prison for life, for child abuse. If they don't, you'll have the misfortune to spend the rest of your miserable and short life in the grim world you will have created, filled by monstrosities from worst nightmares.
If BASIC was mutilating the young minds, Perl is in the line of Cthulhu summoning with minors.
If you build your skills around Python, you'll hit serious trouble if you ever end up needing decent performance or unwrappered OS functionality. If you build your skills around C, whole new possibilities open up to you.
That's the dumbest thing I will have read today. I built my skills around 6502 assembler, written inside a monitor because I didn't know that real assemblers existed. I did my senior thesis on interfacing hardware to an embedded controller. I'm content writing memory-managing, bit-twiddling [sourceforge.net] software in C. At the end of the day, though, I'd much rather write complicated stuff in Python than in anything else. Furthermore, I don't have any problem getting great performance out of it. The fact that you do says a lot more about the way you tried to write software in Python than it does about the language itself.
When was anyone introducing languages to students at 13? There's bound to be a significant chunk of us out there who poked around our computers and went to find these things out ourselves. BASIC just kinda sold itself with the name - you knew it was a good starting point. Self-discovery and a curious mind is probably outdated in the corporatised world, in spite of the roots of many of us who learnt by screwing up an autoexec.bat file or two on Dad's computer. Nothing teaches you to pre-check your logic than having to explain to Dad why his computer doesn't work any more:)
Depends on your age when you start learning. I was 12 when i first met "programming", it was a TI programmable calculator. It was fun to squeeze as much functionality as possible from less than 1K Basic. Then came C64, with its ~38K Basic. Its Basic was very weak, but i learned how to read disassembly when i read the code of various Basic extensions and read books that contained snippets on extending C64 basics. Eventually i made my own Basic extension, cracked games to create trainers, made an own turbo loader that had half of its code on the floppy drive. So, by the time i went to mid school, i programmed device drivers in machine code! I learned PL/I and other archaic languages in mid school, even punch cards! I learned C on my own and was taught in it only by the time i went to high school.
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.
Good programmers aren't easily ruined (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.
Re:Good programmers aren't easily ruined (Score:5, 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).
Parent
Re:Good programmers aren't easily ruined (Score:5, Insightful)
Parent
Re:Good programmers aren't easily ruined (Score:5, 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)
Parent
Re:Good programmers aren't easily ruined (Score:4, Insightful)
Absolutely. It was drummed into me (and apparently most coworkers), and I can't believe how liberating it is once you realize, yes, in appropriate contexts "goto" can result in code (especially in error handling cases) that is both more readable and more efficient. Dogma is rarely the answer.
Parent
Re:Good programmers aren't easily ruined (Score:5, Informative)
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.
Parent
Re:Good programmers aren't easily ruined (Score:4, Insightful)
previousId = id
previousVal = val
beforeEOF = true
while (beforeEOF)
beforeEOF = receive(id, val)
if(not beforeEOF || id <> previousID)
output previousId, previousVal
else
previousId = id
previousVal = val
end if
end while
Parent
Re:Good programmers aren't easily ruined (Score:5, Insightful)
The irony is that under the covers, it's all done with jump instructions anyway.
Parent
Point taken, but... (Score:5, Insightful)
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.
Parent
Re: (Score:3, Insightful)
Much like a chain saw not being an all purpose cutting tool....
So... avoid using it when not strictly necessary, but if it is the only sane/high performance way of getting things done in a special use case, by all means...
Re: (Score:3, Interesting)
I too started out with a range of BASIC varieties. I coded on Commodore PET and 64, AppleII and Color Computer and all sorts of thing like those. I then moved on to Assembly language for Motorola processors. Those two language experiences have the lacking of something in common -- functions; creating them, linking to libraries and all that. This meant I learned to do it ALL myself, whatever it was, and my code wasn't all that portable except for copy, rename and modify to suit. Everything was GOTO, GOSU
Re:Good programmers aren't easily ruined (Score:5, 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
Parent
Fuck him. (Score:4, Informative)
I was on Basic from 1986 to 1993, and it was the most meaningful years of my life.
Seconded! (Score:4, Interesting)
QBasic allowed me to take my learned lessons to the 8086 and add much much more visually appealing graphical interfaces (still mostly games, but also editors etc.)
QuickBasic introduced me to libraries and compilation, i've built some great hardware monitoring interfaces with sensors and relay switches
Visual Basic allowed me to explore the win32 API and libraries, i''ve built some of my greatest applications with it ranging from editors and filtering proxies to a graphical music collection interface I could control with a remote
I loved basic, it taught me so much but most of all it taught me to love programming... The days of fun little programs in basic are over and I have no intention of ever going back... but there is definitely meaning there, and I would recommend anyone to try programming with basic... as a self-taught programmer I can say you will learn a lot from basic.
Parent
Re:Seconded! (Score:4, Interesting)
Commodore Basic taught me to love programming, have fun making little games and all important binary operations and encoding for sprites and font
Preach it. My first exposure to binary was working through the examples in the Commodore 64 Programmers Reference Guide [commodore.ca] (still the best manual I've ever read). Sprites were 8x8 images stored as a 8 bytes, each byte representing a row, and each bit representing a pixel. I probably went through that section 15 times before I truly understood and believed that binary math works, but the lesson paid off in spades. Back then, it was figuring out how to peek and poke a memory location to make a single pixel blink. Now it's loading and storing a memory location to toggle a serial control line on an embedded controller. That little machine gave me a good start.
Parent
Time heals (Score:3, Insightful)
Depends on the BASIC. I use RealBasic at work as an alternative to LabView. It's object oriented, multithreaded and completely "Visual".
as potential programmers they are mentally mutilated beyond hope of regeneration
Am I the only person on the Earth who just writes off hysterical, panty-wetting stuff like this? When did he say this? in the 1960s or something? It's 2010 now, right?
Re: (Score:3, Informative)
Depends on the BASIC. I use RealBasic at work as an alternative to LabView.
RTFA. The author is quite clearly talking about non-block structured BASICs of the MS-BASIC kind.
Am I the only person on the Earth who just writes off hysterical, panty-wetting stuff like this?
Again, read for context. Dijkstra was being intentionally hyperbolic in a joke article when he wrote this. He did intend the point behind it, though.
Re:Time heals (Score:4, Funny)
Parent
Simplicity (Score:5, 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.
Second story from this blog this week... (Score:3, Insightful)
...and I'm wondering: what's with the random sushi pictures?
Re:Second story from this blog this week... (Score:5, Funny)
Clearly there's something fishy going on there...
Parent
Re:Second story from this blog this week... (Score:5, Funny)
Or, more on-topic:
Haiku Overflow
It was programmed in BASIC
System halting now
Parent
Funny argument (Score:5, Insightful)
Re: (Score:3, Insightful)
Some people think they know what spaghetti code is, but unless they've written code with line numbers, they probably don't.
And the good old days of 'LET A = NOT PI' to save three bytes of RAM :).
(ex-Sinclair BASIC programmers will understand why such arcane constructs were beneficial when you were low on RAM)
Re:Funny argument (Score:4, Interesting)
Compare that to the guy I met when I was tutoring CS, who said, "functions, why do I have to use functions to write this program? I know how to use functions, it's such a waste of time." The idiot could have finished the program in the time he spent complaining about it, but he certainly did not feel the joy of discovery.
Parent
In praise of...BBC BASIC (Score:4, Informative)
I never owned a Beeb, though I had several friends that did. I used them at school a lot too, and their BASIC was extraordinarily advanced. The ELSE statement was there, as was the standar(ish) GOSUB, but you could also define true procedures which returned values etc. (DIM PROC), and there was a clean way of dropping down to the 'OS' proper (OSCLI statements).
In addition, it also solved the line number problem you mentioned. It had a renumber command so that everything would become properly spaced out again. I remember the style of coding you're describing from my C64 efforts - the C64 was actually MS BASIC and it was dreadful, anyone wanting to do decent high-levle coding used to get the Simon's BASIC [wikipedia.org] cartridge.
As a whole though, the BBC simply had the best BASIC of any 8-bit I encountered. That's not too surprising given its background and use as a teaching tool, but they did it very well indeed.
Cheers,
Ian
Parent
BASIC is great for kids (Score:5, 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.
Re:BASIC is great for kids (Score:4, Informative)
Parent
Re: (Score:3, Insightful)
I maintain that Python can do this much more easily due to the fact that there are simply fewer ridiculous syntax requirements in a simpler to read format. The things you learn in BASIC can be taught at a much more significant level in Python (inline AND block comments, order of instructions, basic control structures, variables and their use) without jumping through the hoops that you will in BASIC. Python's use of whitespace and extensibility allow beginners with an aptitude to expand on their knowledge ea
Appreciate the difference (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?
Re:Appreciate the difference (Score:4, Interesting)
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?
That quote reminds me of a number of religions who have exactly that attitude. Makes me suspect that it must be a recurrent (though no less foolish) theme to human thought...
Parent
Variety (Score:5, 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.
I started with BASIC (Score:4, Interesting)
Years before I took any formal course, I was looking at the manual of a BASIC computer and making circles on the screen by programming a dot that kept to the same distance to another and rotated. I still remember the emotion of seeing a real circle emerge on screen. I don't know if BASIC helped me much to program, but the immediacy of the thing certainly did much to keep my interest alive.
Re: (Score:3, Interesting)
I too started with BASIC. In my case this was freshmen year in High School back in 1999 on QBASIC. I had dabbled a little with HTML but that was nothing like an actual language that had logic. It was there that I learned the basic blocks that made me the programmer I am today. I went from simple logic to loops to graphics and sound.
By the end of the year I had a full animation of a house with Christmas lights and music. I even had a very primitive text based RPG working with the ending taken straight out of
It's not the language, it's the teacher (Score:4, Interesting)
Most people aren't very good at teaching themselves. I've seen this a lot with people trying to learn Morse code and giving up in frustration.
You can pick up a lot of bad habits without someone to guide you.
Bah (Score:5, Insightful)
Like all eminently quotable people, Dijkstra tended to hyperbole and oversimplification.
It wasn't all that great... (Score:4, Interesting)
...but it was BASIC. And the expectations were so low. "10 PRINT "Hello, World!", "20 GOTO 10" and it started doing something. The programming manual was well worn by the time I was 10, would that have happened with any other language? I doubt it. Things like lack of scoping makes the easy things easier and the hard things harder. The point isn't to learn everything from your first language, the point is to get started and interested at all. Moving to DOS was sorta ok, but moving to Windows killed my interest. C/C++ was just horribly complicated, I remember trying to get up a window in the Win32 API and it was like wtf, how hard can this be? MFC was even worse, Java (really early java, on hardware of the time) was slow and unresponsive as fuck, Javascript was a toy language for websites and never really like Pascal or VB much either. I didn't regain my interest in programming until I went with C++/Qt, or maybe more Qt than C++ really. QMainWindow *mw = new QMainWindow(), mw->show(). The hard stuff is still hard, but I very very rarely find I write "overhead" code that I shouldn't have to.
Easily gotten over (Score:5, Funny)
easy language first your get-over is
FORTH started I at-all me affected not and
Dijkstra ? Legend ? (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.
I'd guess there's a critical period & an attit (Score:4, Insightful)
I think the author is mostly on. He's aware Dijkstra was exaggerating for effect, but also completely correct... if you started programming in the early home computing era, you probably started with a BASIC. I was lucky enough to get some varied exposure earlier to some other languages (LOGO and some shallow assembly), but until I was 15, it was pretty much Basic.
And none of my programming habits now resemble anything close to the BASIC I wrote in when I was that age. Except, occasionally, for the rare cases where global state seems to make sense, and even then, I try to namespace things in one way or another. But by and large, I picked up structured programming, I picked up object-oriented programming, I picked up logic programming, and I'm learning to enjoy functional programming.
I will say... there was a time when I was probably close to being "ruined." It was when I was learning C++, and I only really had Pascal, basic C, and Basic under my belt. And I had a pretty solidly structured-imperative mindset, and really hadn't seen any other way of doing things. C++ married data structures and methods in an interesting way, but it didn't seem like more than a stylistic practice to me. I was pretty sure most languages were alike, you just had syntax and typing differences.
But there was one thing: I'd had to learn Prolog for a very specific job. We were teaching it to high school students in a CS summercamp I worked at for a few years. The first year, I just thought "Man, this is weird," more or less got through all the exercises, and left it behind, and did what most people do: dismiss it as an odd research toy. The second year, I thought "this is weird, but interesting." The third year, I thought "Wow. There are all kinds of intriguing ideas here."
And there are, and I still think it could stand to see more usage in mainstream software, but more importantly, I think I'm pretty lucky I got repeated exposure to a language that forced me to think differently before I got very far into actually working in the software industry.
Because I now think there's either a critical period [wikipedia.org] (or possibly, at a minimum, a critical attitude of some kind) after which a lot of programmers tend to lose either the humility or the curiosity that drives people to think about different programming constructs and habits. I think if a programmer has been minimally exposed before they reach it, they'll keep just enough of one or both of those attributes that they'll be interested in what they don't already know, rather than arriving at the point where "they've already learned the last programming language they'll ever need." [blogspot.com]
And if they don't get so exposed, they become Blub programmers [paulgraham.com], where generally $Blub is some industry-leading language that does enough you don't easily bump up against tasks that are near impossible in it.
To tie this back in with a point I think the author missed, I suspect that some of the difficulties with Basic are actually part of the reason why it didn't end up ruining more programmers. Almost everybody who really came to grips with it as a tool probably realized that it couldn't possibly be the last programming language you'd ever need (if it weren't enough that any effort to look into working as a programmer revealed that Basic was clearly not the strongest payroll ticket).
BBC BASIC (Score:5, 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.
Re:BASIC is irrelevant (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.
Parent
Re:BASIC is irrelevant (Score:4, Interesting)
It's not necessarily a bad thing to have done things in BASIC, but bad habits can be formed by that language. However the other side of it is that if you first see the bad sides of BASIC then you can recognize the good sides of other languages.
And BASIC of today is Python.
Parent
Re:BASIC is irrelevant (Score:4, Insightful)
I think the BASIC of today is Javascript. You see more badly written javascript than any other language..
Parent
Re:BASIC is irrelevant (Score:4, Funny)
Perl as introduction to programming for kids?
You will be lucky if they put you in prison for life, for child abuse.
If they don't, you'll have the misfortune to spend the rest of your miserable and short life in the grim world you will have created, filled by monstrosities from worst nightmares.
If BASIC was mutilating the young minds, Perl is in the line of Cthulhu summoning with minors.
Parent
Re:no, Python is not the language to start with (Score:4, Interesting)
If you build your skills around Python, you'll hit serious trouble if you ever end up needing decent performance or unwrappered OS functionality. If you build your skills around C, whole new possibilities open up to you.
That's the dumbest thing I will have read today. I built my skills around 6502 assembler, written inside a monitor because I didn't know that real assemblers existed. I did my senior thesis on interfacing hardware to an embedded controller. I'm content writing memory-managing, bit-twiddling [sourceforge.net] software in C. At the end of the day, though, I'd much rather write complicated stuff in Python than in anything else. Furthermore, I don't have any problem getting great performance out of it. The fact that you do says a lot more about the way you tried to write software in Python than it does about the language itself.
Parent
Re: (Score:3, Interesting)
just great, more sushi, I should block images from that site
I started with Apple BASIC, and I was playing around with peek and poke before the other students even knew how to properly misuse goto.
But that was when I was 13. The first year of college should not teach BASIC.
But why are we not introducing BASIC or the very beginner friendly 'Ruby' to students when they're 13 anymore?
Re:BASIC is irrelevant (Score:4, Interesting)
When was anyone introducing languages to students at 13? There's bound to be a significant chunk of us out there who poked around our computers and went to find these things out ourselves. BASIC just kinda sold itself with the name - you knew it was a good starting point. Self-discovery and a curious mind is probably outdated in the corporatised world, in spite of the roots of many of us who learnt by screwing up an autoexec.bat file or two on Dad's computer. Nothing teaches you to pre-check your logic than having to explain to Dad why his computer doesn't work any more :)
Parent
Re:BASIC is irrelevant (Score:4, Interesting)
Depends on your age when you start learning. I was 12 when i first met "programming", it was a TI programmable calculator. It was fun to squeeze as much functionality as possible from less than 1K Basic. Then came C64, with its ~38K Basic. Its Basic was very weak, but i learned how to read disassembly when i read the code of various Basic extensions and read books that contained snippets on extending C64 basics. Eventually i made my own Basic extension, cracked games to create trainers, made an own turbo loader that had half of its code on the floppy drive. So, by the time i went to mid school, i programmed device drivers in machine code!
I learned PL/I and other archaic languages in mid school, even punch cards! I learned C on my own and was taught in it only by the time i went to high school.
Parent
Re:BASIC is irrelevant (Score:4, Insightful)
Parent