Brandon's Blog

5/19/2008

The First Language

I see on Proggit the question, “What would you recommend for a first programming language?”

Given that more than a few of my recent non-otherwise-occupied evenings are being devoted to Sigma these days, I of course consider Python as an excellent option.  It is relatively easy to operate (but plenty of hidden goodies like list index slicing and comprehensions), and it has a standard library that rivals that of almost any other language.

Then I wonder: I learned on AppleBASIC/BASIC-A/QuickBASIC.  These were user-friendly (in the sense that they weren’t assembler in the case of AppleBASIC and BASIC-A).  However, they also didn’t pull any punches when it came to challenges in program structure and idioms.

See GOSUB.  What a structure!  You’re talking about numbered lines ticking up ten by ten by ten, then all of a sudden you’re in a completely nondifferentiated subroutine (unlabelled and unnamed) only evidenced by the existence of a “go back from whence ye came” directive at the end (RETURN).

Some more creative program structures were foiled by (what to me was a famous) RETURN without GOSUB).aspx error, which meant your primary execution path had tripped on a RETURN statement without GOSUBbing to that location.

This posting wasn’t intended to be a carp-fest regarding BASIC and its various forms of encumberance to reasonable thought.  This is developing an argument that Python is too darn easy to be a first language.

The lack of preemtive type checking is wonderful for an experienced coder (I’m hearing this or something like it called “duck typing” in reference to a walks-like-a, talks-like-a form of reasoning).

The fact is, a lot of difficult programming involves working around language deficiencies or obstacles.  While Python is not without its issues, for beginners the shortcomings are not obvious enough, in my opinion, to develop those skills.

I think we should all learn on C++ (better syntax, limited built-in library) or Java (horrid syntax, huge built-in library).  Then, we should move quickly (after linked lists or so) to Python.  Then teach how Python allows us to un-learn all the kludgery of C-based memory management and flow control.

An advanced class in Python could draw on the functional aspects of the code, like lambda functions and list comprehensions.