February 20, 2003
Seven Deadly Sins of Introductory Programming Language Design

Seven Deadly Sins of Introductory Programming Language Design (PDF)

An interesting read this, I thought. Most I agree with, some I don't.

It occurred to me that a few of the issues raised might point towards ways of improving Python as an introductory language. (I'm not talking about Java here 'cos I consider Java to be totally inappropriate for beginners.)

  • A single numeric type. Python is already moving in this direction. Slowly. Kinda-sorta. Python's two integer types (integers and long integers) are already pretty indistinguishable from a programmers point of view. The paper suggests that the single type be a rational. The addition of a rational type has been discussed on python-dev, but I don't think that there are any immediate plans to go ahead. But even if there, I just can't see Python abandoning integers and floats. A single type would make life rather easier for beginners, but Python is a real world tool. Anything which would help the beginner at the expense of crippling the experienced just wouldn't fit.

  • A single non-terminating loop construct. I do like the idea of something like a loop statement. The standard idiom for this in Python is while 1:, which I can see a beginner mistaking for something happening once. Perhaps better these days would be while True:, but again, I can see a beginner thinking - while what is true?

  • Zero offsetting. I can certainly see the fact that list[1] refers to the 2nd item of a list is likely to be a problem for a newcomer. But what to do about it? Apart from the practical impossibility of changing something like this in an existing language, (can you imagine the furore on c.l.py if this was suggested!), it's also the case that in practise this is a more convenient notation. If beginners started off with 1 offsetting, and had to move to zero offsetting later, well, that's even harder. And I speak from experience here, coming from RPG.

On reflection, it seems that none of these would have any chance of making it into Python. Only the non-terminating loop construct would be reasonably backward compatible, and while while True: is ugly, it works. Ah well...

One thing I didn't agree with, (as you might expect from a Python fan) is the paper's assertion that using indentation to specify scope is an example of 'detrimental cleverness'. It refers to 'useful redundancy' between delimiters and indentation. I don't see it as useful redundancy, I see it as potentially confusing. If the two don't match, which is correct (in terms of the programmers intention)? Redundancy is almost always A Bad Thing in code, and having both delimiters and indentation is no exception.

What I don't see, though, is any indication that all this is anything more than personal opinion. Informed opinion, yes, but opinion nevertheless. Real useability studies would be good.

Via iamcal.

Posted to Software development by Simon Brunning at February 20, 2003 01:29 PM
Post a comment

Email Address:



Remember info?