rfunk: (Default)
Rob Funk ([personal profile] rfunk) wrote2006-09-14 02:39 pm

Programming Languages: Pining for BASIC?

Salon is running a story wherein author David Brin complains that the computer world's deprecation and collective purging of the BASIC programming language (which of course he grew up with) is somehow hurtful to the technological development of today's kids, including his own. He seems to think that BASIC is a low-level programming language that helps kids understand how the machine works. Of course, the only way BASIC is low-level is that it encourages use of goto, like machine language and unlike modern high-level languages. Otherwise it is designed to insulate the programmer from the machine.

It seems to me that Brin is stuck thinking that the way he learned things is the only way to learn them, and he doesn't seem interested in modern options. I grew up on BASIC too, but I got away from it as soon as practical, and I wouldn't recommend that as a way for anyone to learn programming today.

If Brin wants his kid to learn something close to the machine (his major professed goal), he should choose C. If he wants his kid to learn a language that lets him ignore the machine and do higher-level algorithm work (part of the original goal of BASIC), he should choose Python or Ruby. Responses at Salon also mentioned programming TI-82 calculators, Lego Mindstorms, and other options that modern kids have and were unavailable to past generations.

On top of all that, today's technically-interested kids can put Linux or BSD on their computers and not only choose from a wide selection of programming languages to use (rather than the BASIC interpreter built into the computer and whatever else their parents could afford, as the previous generation did), but also delve as deep as they want into how all the pieces of the software and operating system work.

In one sense, however, Brin has a point. He mentions that his son's math textbook includes BASIC programs to demonstrate the algorithms. Since the computer world has rejected BASIC (a message the textbook writers seem to have missed), there is no single universally-accepted replacement. But that's mostly because of Microsoft - unlike every other common operating system today, Windows doesn't come with any development tools since they deprecated QBasic starting with Windows 95. On the other hand, MacOS, Linux, and BSD usually have Perl, Python, and others either built in or readily available for download.

Perl may be the closest we have today to a universally-available programming language -- it's an easy download and install on Windows, is generally built-in everywhere else, and is quite mature and popular. Many complain about its syntax, though most of that weirdness is obsolete and easily avoided. Python would be second (and a better first language), but it too has its quirks (well, one major quirk plus an object-orientation annoyance). Maybe Ruby is the way to go these days.

[identity profile] kittenpants.livejournal.com 2006-09-14 07:01 pm (UTC)(link)
I couldn't agree more, and I learned on BASIC, too. Well, let me rephrase that. I took a class in BASIC programming in highschool, which I *failed*. But after college, once I got my hands on object-oriented languages that could be used for real-world applications, I shot to the top of the class and entered the professional field almost immediately, and successfully.

Personally, I think that the way to teach kids programming and get them interested is to do it in real-world applications, not by making them do programming exercises that are 25 years out of date.

You might start with a web design class, teaching the basics of html. From there, go to a PHP and SQL class, teaching scripting for the web. Then, they have familiarity with a lot of the concepts, like variables, expressions, loops, and i/o. From there, move on to a programming language that can do standalone applications.

That way, every step along the way they can produce something they can get excited about ("Hey mom, I just made a web page!").

[identity profile] rfunk.livejournal.com 2006-09-14 07:21 pm (UTC)(link)
I think I finished my programming classes shortly before object-orientation took over, and it took me a while to warm up to OO later. So I'm slightly biased against OO, though at this point it's mature enough that it makes sense to learn it from the start and avoid difficulties with it later. That's one thing I like about Ruby over Python - Ruby's OO is more complete and intuitive.

It definitely helps for kids (or anyone learning) to be able to produce interesting results quickly. I'm not sure about web programming as a stepping-stone though, especially with PHP. PHP is nasty and encourages bad habits, SQL requires some abstract set thinking, and there are so many different languages involved that it could get too confusing too fast.

On the other hand, I do think everyone should be learning HTML these days. As long as they don't think writing HTML is programming.

[identity profile] kittenpants.livejournal.com 2006-09-14 07:11 pm (UTC)(link)
Also and, I'm a big fan of teaching things like this well before highschool. Programming languages are picked up using the same wetware as natural languages, and language-aquisition skills atrophy with age. Children learn foreign languages (and programming languages) much faster and easier than teens do, and teens learn them better than adults do. Refusing to teach children languages other than their native tongue until they are in highschool is dumb, and sets them up for failure.

But, there may be personal bias here, too, because I had mandatory foreign language and computer classes all through elementary and middle school, and when I then went to a public school that didn't have that sort of program, I was leagues beyond the other students in these fields, and could consistently outperform them even when introduced to totally new languages or software.

[identity profile] ladyvonkulp.livejournal.com 2006-09-14 07:22 pm (UTC)(link)
His son is how old...?

How old

[identity profile] rfunk.livejournal.com 2006-09-14 07:29 pm (UTC)(link)
Apparently 8th grade, though he's apparently been at this since 5th grade.

BTW, I started programming (in BASIC) in 4th grade, later picked up some assembly language, then learned Pascal in high school, and both Modula-2 (basically a fancier Pascal) and C in college. Based on my experience, I agree with [livejournal.com profile] kittenpants that it makes sense to start them relatively early.

Re: How old

[identity profile] ladyvonkulp.livejournal.com 2006-09-14 07:52 pm (UTC)(link)
As long as he's school-age. A friend, before he ever had kids, swore that his offspring would be programming by the time they were two. His first child just turned one, and I haven't heard 'goto' out of his mouth yet. I'm guessing dad has laid off a leeeeetle bit on the geek aspect.

Re: How old

[identity profile] rfunk.livejournal.com 2006-09-14 07:59 pm (UTC)(link)
Yeah, before school age is way too early! I would think 2nd or 3rd grade would be the very earliest.

Re: How old

[identity profile] ladyvonkulp.livejournal.com 2006-09-14 08:03 pm (UTC)(link)
Well, when he said this, the friend was about as close to an unemotional robot as it came. He's warmed up a lot since then.

Re: How old

[identity profile] kateryndraper.livejournal.com 2006-09-14 08:14 pm (UTC)(link)
Is this someone from Unicorn?

Re: How old

[identity profile] ladyvonkulp.livejournal.com 2006-09-14 08:16 pm (UTC)(link)
Yep, it's the person you're thinking of.

universally available

[identity profile] heracolyte.livejournal.com 2006-09-19 12:37 am (UTC)(link)
Python may actually be more universally available than perl.

Microsoft has recently released their own version of Python. Python is on OSX and I think most linux versions have python as well. Perl's standing isn't quite as strong on OSX or Windows.

I find in perl I have to manage more extraneous code than python, so I tend to prefer python.

What do you feel is python's major quirk? I find python's OO very unobtrusive (unlike Java or C#).

Ruby does look to be a good language but it is on the same vector as python, so it is not interesing enough for me to mess with. (I don't gain than much more productivity or solve problems in different ways)

Languages like, Erlang and Haskell are on other vectors and look very interesting.


Re: universally available

[identity profile] rfunk.livejournal.com 2006-09-19 01:22 am (UTC)(link)
Python's big quirk is its indentation instead of block start/end markers, making it unlike any other language I'm aware of.

Its major annoyance, however, is that its OO is incomplete. Constants don't seem to be objects. Various operations work in a functional way rather than an OO way, while other operations are OO. Therefore it can be difficult to intuitively figure out whether to do x.foo or foo(x) or ClassName.foo(x).

I was quite happy when I discovered that Ruby fixes all these problems, plus includes many of the conveniences of Perl.

Someday I might mess with Erlang or Haskell. The only functional languages I've done anything with are Lisp and Scheme, and I haven't done much with them.

Re: universally available

[identity profile] heracolyte.livejournal.com 2006-09-19 04:03 am (UTC)(link)
I read somewhere that Ruby has a "do what I mean" philosophy and Python has:
"in the face of ambiguity refuse the temptation to guess". Whether or not you prefer one probably depends on your personality. Since they are both very capable.

I think they are close enough the 2nd order effects become important in choosing (do you need a web framework=ruby, do you need heavy number crunching == python)

With regards to indendation, in most common programming languages you indent anyways. Effectively, it is as if you have the same code with the parens (or whatever) erased. In other words, the parens are superfluous line noise. I've programmed in other languages for years, and I have never found myself limited by python's indentation. Perhaps in theory there could be a problem just like in theory static compile time typing may give you more reliable code. However, in practice that does not seem to be the case. It is probably something you have to try to know.

Ruby has an ambiguity, though I could be wrong. In Python you have to have () if you want to do any type of call: foo() object.foo(),etc.

In Ruby, object.foo -- is it a method call or an attribute? You cannot tell w/out more context which means you have to look at more code.

Erland, btw, looks really cool. Just like bytecode from back in the 80's pascal days is finally coming into fruition, I see erlang's ideas about threading (I think they got like 20 million threads running on a typical sun box!) to be something other languages will look at.

I'm tired, I hope most of this is coherent . . . .

Ruby, Python, etc.

[identity profile] rfunk.livejournal.com 2006-09-20 07:45 pm (UTC)(link)
I know of at least one web framework for Python, though Rails certainly gets the attention these days.

I disagree that block markers are superfluous. It's useful to see exactly where a structure ends, and it also helps some editors with their features. Also, doesn't Python treat a tab as a single indent rather than 8?

But anyway, I don't see the indentation thing as a big deal, just a quirk. The inconsistent OO is more bothersome to me.

As for the object.foo thing... it could be argued that it's a feature not a bug, as in "you shouldn't really need to know whether it's a method or an attribute."

I don't really know anything about Erlang....

Re: Ruby, Python, etc.

[identity profile] heracolyte.livejournal.com 2006-09-20 09:52 pm (UTC)(link)
Since the block defines the structure in python, you always know where it ends. Editors I use do not have a problem with it either. I am not sure I understand the issue. (tho I remember when we hired a perl consultant, we had problems with his use of parens and ours)

With regards to "you shouldn't really need to know whether it's a method or an attribute."
I think you do need to know. In ruby the mention of an object either means a reference or a call to the object. If you don't pay attention, you may accidentally call something when you didn't intend to. So, it is necessary to know.

Btw, I am not saying python is better than ruby. Python does have warts like with default arguments being bound only when the function is created and such. In practice, I just never found the things you mentioned to be warts.