Saturday, October 18, 2014

[wkedncfb] Pedagogical programming languages

The best beginner programming language would probably be the one with the best error messages because beginners will make lots of errors.  Extremely simple syntax.  Or perhaps many strings are valid programs. GOTO and IF as the only control constructs.  Arbitrary precision integer as the only variable type.

Is this subset of programming constructs interesting enough to keep a beginner programmer interested?  It probably depends on the standard library available. LOGO.

After that, what is the best "intermediate" programming language?

We could imagine a language with series of pragmas which enable higher-level constructs that the beginner turns on as he or she gets more advanced, perhaps through guided learning: StructuredControlFlow (e.g., "for" loops), Subroutines, Recursion, StructuredTypes, Arrays, HigherLevelFunctions, etc.  The error messages become more varied as the features interact.  Error messages should explicitly state which language feature it is about.  The programmer, if not expecting an error about that feature, can try turning the feature off to see what happens.

How can we encourage beginners to learn the more advanced features when (say) spaghetti code of GOTOs "works"?  There's an alternate school of CS pedagogy which attempts to teach structured programming from the start.  But this has a more steep, more difficult initial learning curve.

Should the end of the path, with all the features turned on, be a real programming language?  If not, how can we force it to remain pedagogical and prevent people from writing production code in a language not designed for production?  Pascal had this problem.

(What is meant by a language for production rather than pedagogical use?  Perhaps features like deliberate awkwardness to be able to compile to efficient code on modern architectures, syntax for writing useful libraries, linking with code written in other languages, concise syntax, features for software engineering: collaboration, playing nicely with version control, IDEs.)

Rather than pragmas, could a programming language have the ability to toggle its own features expressed in the language itself?  Probably Lisp.

No comments :