BASIC vs Python

Andrew Dalke dalke at dalkescientific.com
Sat Dec 18 08:32:39 CET 2004


Adam DePrince wrote:
> Sure you could have.  There is nothing I hate more than the dumbing down
> of technology for the sake of families with children.  Having kids
> doesn't make you dumb, it only makes you feel that way when you realize
> how quickly your children's technical prowess with outstrip your own.

Huh?  I'm talking about my views of myself.  I said that
BASIC was a programming language I could learn without access
to anyone else, on a microcomputer circa 1982.  All I had was
the book that came with the computer, and after a while a
book on BASIC games.

The machine I had was a TI 99/4A.  My Dad got it because the
marketing said "it's a 16 bit processor which is the wave of
the future; the other machine only have 8 bit processors."
It came with BASIC.  LOGO was available, now that others reminded
me about it.  It was available as a cartridge.  I saw it once
or twice.  There was just more things I could do with BASIC.
It supported sprites, which made games easier to write (I did
a lunar lander game), it had access to a three voice sound
chip, and the speech synthesizer.  I don't recall that the
LOGO supported any of those.  Plus there were books and magazines
with programs in BASIC and because my friends had different
machines, running BASIC variants, I could do things with them
too.  Network effect.

The only other language I ever saw for it was assembly, also
available on a cartridge.  Assembly let you do cool things but
I couldn't make heads or tails of how it worked.

When I got my Heathkit H-151 (PC compatible) it also came
with a BASIC, GW-BASIC then BASICA.  By that time I had a
lot of experience with BASIC and didn't have any programming
tasks which hit its limits.  I was only 15 after all.

I probably could have learned another language instead
of BASIC.  But then again I could have played more piano,
or taken up soccer, or read more, or all sorts of other
things instead.

> To Apple and Atari this was true, maybe, but other companies had their
> sights set on the much more lucrative industrial market.

Which is why I started by saying 
>> That doesn't sound like the 1980s I remember but I was biased
>> because I those included my teenage years and I wasn't a manager.

> Simple and cheap to implement for sure, terribly obnoxious to use. 

But it was easy to debug chunks of code by doing (forgive
the typos as it's been a long time since I've done BASIC)

200 input "What is your name?", a$
210 print "Hi,", $a
220 print "Did you know your name has";
230 print strlen($a);
240 print " letters in it?"
list 200-240
241 END
a$="Andrew"
goto 210
del 241

This is somewhat doable in Python by being able to
call newly created functions by the shell, but it
does require knowing how to make functions.  Again,
recall the context is "new programmer, 12 years old,
no teacher, might have learned other things had the
learning curve been too hard."

The tron/troff commands made debugging not painless
but something feasible on that era of machine.  A modern
system can do much better of course by using multiple
windows.


> There was nothing preventing the implementation of a proper
> edit/compile/execute cycle in 16k.

Which is all I had.  But most of what you're talking about
would be in ROM on the cartridge.  My lunar lander game
took about 15KB.

> The operative word being standard.  TI 994/A BASIC was hardly standard
> BASIC.  Sound and graphics have no place in a base language definition;
> use an add on module for that.

In the context of early 1980s hardware, just how would I have
done that?  Buy a ROM cartridge for sound and another for
graphics?  Only one could plug in at a time, though I did
have a widget with a 3-way switch that let me select which
of three cartridges to use.

Oh, and I did get the Extended Basic cartridge.  That let me
have IF/THEN/ELSE statements!  (The default BASIC had no ELSE)

> For the record, Python does have graphics in its base distribution -
> TK.  Search freshmeat and you will find ample sound libraries that could
> be plugged in.

Using Tk isn't as simple as doing graphics on the old TI.
When there's one screen, no windows, and the I/O is dedicated
to the user, well it makes things pretty simple.

To go into graphics mode is one command.  On the Apples and
Ataris there was even a combo graphics/text mode which made
it fun to experiment with drawing.  The same for straight
Tk is by comparison more difficult.

Had I started now it wouldn't be hard; it would be a black
box "follow these instructions".  But the closer equivalent
is the turtle module which manages the window management
for me.

> Perfection is having nothing else to remove; TI BASIC's bells and
> whistles hardly made up for the lack of fundamental expressiveness
> available in a language like Lisp or Forth.

So what?  It's not like I needed them the first couple of
years I was programming.  I wrote games, played around with
math, made a 5 minute video for an English report, wrote
a program to quiz myself on Spanish vocabulary.

The only thing I didn't understand was how stacks worked.  I
wrote a pre/post/infix converter by basically faking it
using arrays and string substitutions, but my BASIC in BASIC
couldn't handle gosubs.  Perhaps Lisp or Forth would have
helped me with those because I would have needed to understand
stacks in order to program in them.

Even in college my projects were all doable in QBasic,
including a printing system that let me write text along
a curved path and an X-ray analysis package that would
give the crystal structure and likely element type (for
simple metals) given the diffraction band locations;
including a GUI for specifying the band locations.

Given an additional 10+ years of experience, I don't
see how learning Lisp or Forth instead would have made
much difference.


> If you really miss the pc speaker style music, it isn't too much trouble
> to: open( "/dev/audio", "w+" ).write( my_sample )

>>> open("/dev/audio")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: [Errno 2] No such file or directory: '/dev/audio'
>>> 

I'm on a Mac.  A closer fit would be midi output, not
playing a sound clip.

> I don't understand, are you presenting yourself as an example of my
> assertion?

Yes.  I was a beginning programmer.  I had years in which
to transition from BASIC to Pascal to C to C++ before I had
a real programming job.  It didn't matter what my first
language was, the important part was learning algorithmetic
thought and finding out that programming was fun.

I would not say that BASIC is the right language now for
this, but in the early 1980s I think it was a reasonable
one.
 
> You don't really think my intent was to be objective and unbiased?

Not at all.  I was showing how even your biased view can
be recast closer to my memory of the microcomputer era
of the early 1980s.

[As alternate languages]
> Lisp
> Forth

Err, I don't think so.  Yes, they could have run on the
machines of the time.  I think the learning curve would
have been higher and made it more likely that I and others
would have decided to do something else instead.

Remember, it took me a month or two to learn how arrays
worked.  And that was after programming for a while.
(I had been using simple variables.  My first real program
was to compute GCD and LCM, which I showed off in math
class in 7th grade.)  Lisp's starting point requires
understanding trees and Forth's is stacks.

As I recall, my first BASIC program, copied from the
book, was essentially the proverbial Hello world, as

10 INPUT "What is your name?", A$
20 PRINT "Hello,", A$
30 END

(Though I left out line 30 because I had read that it
was optional.)

What would the equivalent LISP and FORTH have been?
Do you think it would have been as easy to understand
to a 7th grader who was quick with math and was in
the pre-algebra course?  I don't.

I'm not saying I couldn't have figured it out.  I'm saying
that I could have decided that other things were more
fun than learning those languages on my own from a book.


> Thank you for feeding me.

You're welcome.

				Andrew
				dalke at dalkescientific.com




More information about the Python-list mailing list