Learning Programming In a Post-BASIC World
ErichTheRed writes "This Computerworld piece actually got me thinking — it basically says that there are few good 'starter languages' to get students interested in programming. I remember hacking away at BASIC incessantly when I was a kid, and it taught me a lot about logic and computers in general. Has the level of abstraction in computer systems reached a point where beginners can't just code something quick without a huge amount of back-story? I find this to be the case now; scripting languages are good, but limited in what you can do... and GUI creation requires students to be familiar with a lot of concepts (event handling, etc.) that aren't intuitive for beginners. What would you show a beginner first — JavaScript? Python? How do you get the instant gratification we oldies got when sitting down in front of the early-80s home computers?"
And why doesnt BASIC still work? Any reason they can't still use BASIC?
It's lightweight, portable, and has a ton of interesting projects for learning. Start here at http://www.ruby-lang.org/en/ Check out the "Try Ruby in Your Browser link" on the right hand side.
Agile Artisans
http://processing.org/ it's easy and gives immediate gratification.
It all starts at 0
Google it. Especially if you like the Sims, try the 3.0 beta. Other than that I'd second HTML + Javascript. You can very quickly get up an running with something fun and interesting.
Hi! I make Firefox Plug-ins. Check 'em out @ https://addons.mozilla.org/en-US/firefox/addon/youtube-mp3-podcaster/
God no. Visual basic is a very syntax sensitive language with huge libraries. It is like the anti-beginner language. Even microsoft's other major .NET offering(C#) is better.
My reccomendation is python, with a lean towards using graphics libraries like vpython. Being able to go mysphere=sphere() is glorioiusly simple and have it show up in 3d is grand.
Python has the following features that are great for learning:
interactive debugger- type your program line by and and see what each line does.
english-like syntax(except elif). As much as possible, python is designed to be written as it would be read out loud. eg: for item in array: print item
at the language level, absolutely no machine restrictions. Integers can get as big as your ram, no pointer math,
It's almost certainly the best choice.
"How do you get the instant gratification we oldies got when sitting down in front of the early-80s home computers?"
By using a language that has lasted through that time to this one: Fortran.
Fortran is still one of the most widely used languages in scientific applications, and is a great starting point for beginners.
When I was a kid, the computer i programmed for (trs-80), was one of the first computer I ever saw. There were not that many programs for it. So it was easy to get excited about almost nothing.
Now all the kids have been exposed to all sort of technologies. They'll never get excited by very simple things like I have been. The thing to remember is that it will never be has rewarding has it was at the time for such simple things and no language is going to change that.
Grab a TI calculator. Learn the slightly weird version of BASIC installed on them. That's where I got my start.
You can write an actually useful program in just a few lines. It's got a few simple data types (floats, strings, lists and matrices), has a few basic functions (Disp, Input), and all the common language constructs (If-Then-Else, For, While, Goto). There's a few oddities (assignment is reversed, instead of "a = 2" you have "2 -> a"), and there's no proper way to declare a function (you can either make another program and call it, or use goto), but you can do a surprising amount with it.
I programmed those for a year or so. Tried learning assembly to get around the limits of Basic (mostly the speed), couldn't do it. But I did get into C++, and later all the other "real" languages, and am now pretty much a real programmer.
Are you implying that my habit of using "elif" in natural-language conversation may be marking me out as some sort of deviant geek weirdo?
I learned BASIC first. When I was shown LOGO, I wrote a few lines of code to draw a Sierpinski triangle, and thought to myself: there is no fucking way this can be this simple. It worked, though, and sure got me to appreciate the weird academic languages.
Tsunami -- You can't bring a good wave down!
MIT's Scratch ( http://scratch.mit.edu/ ) has gotten my kids started with programming. It's fun, and teaches all the fundamentals necessary for learning programming logic.
I too started with basic in middle school but it did not teach me much. In high school we did fortran, which taught me mad skills, then I taught myself C and C++. I still think C is important for people who want to do serious programming as it does not have the cruches of the other languages, is simple enough to be put in a two hundred page book, and will teach everything one needs to know about debugging and basic design.
In terms of instant gratification, I would suggest writing web apps in python. Most of the GUI stuff is taken care of by the browser, Python takes care of parameter passing to and from the user, and one can teach all the concepts, aside form parralel programming. A kid can write any number of games and if one has access to a web server, it can be run anywhere there is internet access. Such a thing can be great motivational tool.
"She's a scientist and a lesbian. She's not going to let it slide." Orphan Black
You should definitely look at Scratch, which is designed for kids, even (especially?) kids who don't type very well yet, yet it teaches them programming skills. This is the same crowd who initially did Logo all those years ago, and they think this is better...
- "History shows again and again how nature points out the folly of men" -- Blue Oyster Cult, 'Godzilla'
Python is not a good solution. Especailly if you are worried about syntax sensitivity as your parent poster was. Sure white space is a good thing to organize your code, but the actual execution of your program shouldn't be changed by the lack of whitespace. Python is a pretty good language overall, but forcing beginners to understand that whitespace makes a difference in how something executes is asking for trouble.
Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
I'd recommend Brainfuck. It has no library at all to confuse beginners and only 8 commands.
Python, Perl, Lisp, Scheme, BASIC, Java, JavaScript, shell... it doesn't matter. Pick up whatever feels most comfortable, or whatever tool is most readily available. Learn the basics of flow control, data structures, and the most fundamental algorithms. Learn how to debug, document, log, build, install and maintain.
Once you've mastered these basics, move immediately to C (not C++). Programming in C will teach you what it is that you're actually doing in that high level language, and force you to manage everything that you want to do. You don't just instantiate a new class to get a thread or forget about that variable's storage when you're done with it. You have to think about the details and understand them, and even if your entire career is spent writing Python, you still need to understand these things. I'd recommend assembly, but there's a lot more well documented sample code in C to work from, and getting larger projects done in C is still practical, if somewhat painful.
Once C is something you're comfortable with, trying out C++ is an excellent next step, but that's probably best determined by what you want to / have to work on.
What I find amusing is how completely Pascal has disappeared from both historical memory and current usage. Some of you may remember the 80s for Basic on a C64, but I remember a huge bandwagon for Pascal both as a teaching language and as a working language. (I am not advocating Pascal, just reminiscing.)
How about starting with assembler?
http://altdevblogaday.org/2011/03/24/machine-code-is-for-kids/
Mada mada dane.
As somebody who writes Python professionally, I'm a bit biased, but can say with some assurance that the whitespace thing is not a major problem in the Real World. It's certainly no more of a problem than any other technique for designating a code block.
Compare these:
' Basic
If a == b Then
do_something()
EndIf
/* C and relatives */
if (a==b) {
do_something()
}
; LISP and friends
(if (== a b)
(do_something))
# Python
if a==b:
do_something()
Are you seriously suggesting that the last one is more confusing than the others? If your blocks are large enough that they can't easily fit on a screenful, you have other problems not related to your language of choice.
There are things to go after Python for, but whitespace is definitely not one of them. My take on its strength as a teaching language is that it can do really simple beginner stuff and really advanced stuff with graphics and sound (with the right libraries installed).
I am officially gone from
If you format nicely, sure, that's true enough, and while I'm a fan of teaching proper indentation, your examples are technically incorrect (the best kind of incorrect!).
Your code in BASIC:
' Basic
If a == b Then
do_something()
EndIf
Functions identically if you do this:
' Basic
If a == b Then
do_something()
EndIf
Or even this:
' Basic
If a == b Then
do_something()
EndIf
However, in Python, I believe this:
# Python
if a==b:
do_something()
is not identical to this:
# Python
if a==b:
do_something()
or more specifically, not identical to this:
# Python
if a==b:
do_something()
And even if that is functionally identical (due to the brevity of the snippet), a larger structure which requires varying levels of indentation would not be. This would, admittedly, be painful to look at from an experienced programmer's point of view, but having no indentation is how I remember learning to write in BASIC the first time (since line numbers and explicit structure end syntax controlled flow anyway).
That all said, from what I know of it (and I've only briefly used it several years back, so my knowledge may be out of date or mis-remembered), I'm in favor of Python as a learning language (and a language in general), but I can see the potential concerns for teaching if one doesn't expect the student to be able to maintain perfect (or even good) indentation formatting for some reason. Having explicit non-whitespace characters control program flow might be slightly easier for a new programmer to understand -- and using an editor that automatically indents code based on those characters would help them understand good formatting (along with helping them see the code structure form as they write), and enable them to transition quickly to Python later, where you're essentially just dropping the explicit curly braces in favor of implicit ones using indentation.
~Anguirel (lit. Living Star-Iron)
QA: The art of telling someone that their baby is ugly without getting punched.
Back in the day I learned a lot from programming Hypertalk (Hypercard) on my parent's Mac LC. Despite the somewhat heavy syntax sugar, it really let you do a lot with very little, and all of that sugar meant that you could figure out what is going on by simply looking at the code. I'm still annoyed at Apple when they started shipping the player instead of the full development environment, and when they eventually dropped it entirely. The code is still around, but it's wildly overpriced for kids and example code is much harder to find.
Still, the ability to put a button on the screen, and then pull up the code in the button to find:
on mouseUp
ask "Please enter a number"
put it into theNumber
answer "You entered " theNumber
end mouseUp
That's the sort of thing you can build off of very easily.
I read the internet for the articles.
or more specifically, not identical to this:
# Python
if a==b:
do_something()
That is not permitted in Python. It is a syntax error. You must either list a statement on the same line, or begin an indented block. If you want an empty block, you use the 'pass' statement. See, it's almost as if there are features designed into the syntax to help prevent mistakes. How odd.
Oh god, this.
Years ago I got into a bit of a row with a co-worker. He liked two space tabs, and insisted on using emacs, which is fine ... except emacs replaced a series of tabs with a single tab (or something) that it interpreted as needing to be indented according to its own rules. But left the file unusable for everyone else because they weren't privy to these fancy rules, they were just text editors.
Basically, every commit he made looked like the entire fscking file had changed. It took days for him to understand that I don't care if he sees tabs as 2, 4, or 8 chars ... but if he couldn't make the resulting output something which I could still edit in vi or every other editor we used, I was going to lock him out of CVS. Because once the file had been edited in emacs, it was fucked up for anybody not using emacs. When the display preferences of your editor start to affect other things, it's bad -- you can't break it for the lowest common editor just so you can have syntax highlighting in emacs. He didn't seem to understand that I wasn't complaining about his visual preferences, I was complaining about what it was doing to the actual source files.
I'm not sure I agree with your arguments in favor of whitespace being syntactically meaningful (I personally think it's stupid) ... but, the amount that I code has dwindled over the years, and it is what it is. My exposure to Python a bunch of years ago left me with a very bad impression of it as a language as it seemed to rely on/advocate some really poor coding choices that when carried into a different language made for absolute shit code -- C does not benefit from that kind of layout, in fact, it becomes absolute crap.
(Actually, I vaguely remember letting someone else go who wouldn't adhere to our coding standards ... he didn't seem to understand that it wasn't his own personal code base, and that far more than just him was affected by his choices. He seemed to think that I was stifling his creativity, as opposed to protecting the integrity of a huge code base which had been around for some years and represented the product as built by people far smarter. No great loss, he was fairly useless anyway.)
Lost at C:>. Found at C.