Reinventing square wheels

posted in: Programming | 2

A joke in Punch, well over a century old now, showed a traveller asking for directions and getting the reply Well sir, if that is where you want to get to, I would not start from here if I were you. There have been a good many threads in RISC OS blogs and mailing lists, started by a request for advice on how to solve some programming problem, which can only justly be answered this way.

We have to recognize that learning a programming language is a big investment of time and mental energy; so many people, having learnt one, usually BBC BASIC, are unwilling to start again with something different.

Moreover, it is natural that people should take pride in their efforts, and feel a pang of nostalgia for their youthful days when all things to do with computing had a halo of mystery. The same remarks may apply, for some, to coding in ARM assembler.

The trouble with this is that no programming language can be the best tool for all jobs. Although this is rather obvious, many people of limited programming experience do not fully appreciate this point.

Perhaps somewhere at the back of their minds lurks a miscomprehension of the fact that any Turing-complete programming language can simulate any other. Language wars are pointless when this point is properly understood. That is not to say that we cannot compare languages according to specific criteria.

When Acorn started they had to make many compromises if their products were to be afforded by schools. Nevertheless, in Cambridge, Acorn computers were used for one or two quite exotic academic projects in the field of programming language design.

But they were hampered by the high cost of memory in those days, so only expensive workstations could run systems with automatic memory management. Under the circumstances, equipping RISC OS with BBC BASIC was the best that they could do.

By the time that the cost of memory chips had come down sufficiently, Acorn was no longer on the scene, and the initial educational impetus was lost.  Because reinventing the wheel is a necessity for learning (otherwise the student is faced with magic rather than reason) BBC BASIC still has a good educational role to play.  But it does not expose students to important ideas in programming that have arisen since BASIC was invented, and so may leave them with a distorted idea of what programming is about.

This was the point of Dijkstra’s famous dictum:

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.

In a very loose sense Acorn’s educational impetus has been taken up by the Raspberry Pi, with Python as a modern actor in the role once played by BBC BASIC.

There have been ports of earlier versions of Python to RISC OS that provided access to SWIs. Let us hope that some dedicated enthusiasts (younger than me) will make Python as attractive an educational tool under RISC OS as it is under Raspbian. Python is gaining in popularity and it comes with batteries included, unlike Lua (which I prefer for its simplicity).

For problems involving:

  • pattern-matching and capturing data from text
  • number-crunching and cryptography
  • symbolic computation and algebra
  • anything involving strings of indefinite size
  • grammars and parsers
  • complex datatypes

and much else, you should probably not be using BBC BASIC. Of course, trying to use BASIC for such things may be instructive, but also a bruising waste of time. Better to widen the horizons.

2 Responses

  1. Krzysztof Klis

    I’m a professional programmer and, as probably many other programmers at my age, I learned programming myself as a kid, starting with Basic. At school they tried to teach us Pascal and Logo, but Basic was the only programming language I could understand back then. I don’t feel “mutilated” by Basic, I owe it my professional career. I would have never learned programming if I had started with Java. All the mistakes I made, and all ugly and unmaintainable programs I wrote, were due to the lack of knowing proper programming patterns, not due to the language I used.

    • Sion

      Completely agree, if it wasn’t for coding in BASIC, Bash, Python etc I’d have never moved onto the ‘hard stuff’ as it were. Picking up on common errors and bad habits is far easier easier in languages like BASIC I find, so it really helped me have the mindset needed to work with other languages.

Leave a Reply