More information about the Underscore mailing list

[_] Should kids learn C++ or PHP

Tom Gidden tom at gidden.net
Fri Jul 12 19:52:27 BST 2013

On 12 Jul 2013, at 12:23, Dan Course <dan at thoughtden.co.uk> wrote:

> So I've been wondering, with the changes to the curriculum pupils will start learning about coding/algorithms… 

Going back to the original question, I reckon I'd go down the Java route, although steering well clear of the API beyond the most abstract levels.  I'm saying that as someone who can program Java but chooses not to, so I'm not being a cheerleader by any stretch.

(As a programmer, I currently write PHP as a means-to-an-end; Javascript out of choice, because Node.js and all that async stuff is neat; Perl when I need to; C when I really need to; Objective-C if I have the time; OpenCL and GLSL when I'm really procrastinating; Emacs Lisp when I've got an itch to scratch; but I'll have a go at just about anything.)

Rationale:

*  Relatively strongly typed;

*  Relatively clean, simple and typical OO paradigm;

*  Nothing too weird in it;

*  Fairly ubiquitous syntax;

*  Well supported;

*  Abstract machine model, so you don't have to delve too far into weird exceptions-to-the-rule when explaining concepts;

*  No memory management;

*  Compiler can be real pernickety.

I figure that a weakly-typed language with a concentration on runtime errors rather than compilation-time will allow the beginner to learn a lot of REALLY bad habits, as there's nothing telling them that what they're doing is wrong.

The real pain of Java is in the API;  the language itself is fairly neat and probably suitable for teaching clean code. A subset of Java without all the complicated to explain bits would be good.

It's the question of teaching good programming, as opposed to teaching someone to be able to program.


The alternatives?

* C++: too complex; has weird memory stuff to learn about; badly-written code can have unexpected results.

* C: as with C++, but even moreso. Plus, no OO capability, which is a good thing to learn, even if unused.

* Perl, Python, JavaScript, ActionScript, Ruby, PHP: too forgiving/lenient/bizarre/dangerous/powerful.

* BASIC: WHY?!  It has no distinct advantages over the others, and loads of disadvantages.

* LISP, Haskell: too damn masochistic. Next to useless in the real world. Hard to relate to other languages.

* Logo: What's the point?

* Assembly: Actually, there's an argument for learning programming from Assembly upwards. It works for Knuth. I learned the lion's share of my coding in Assembly, followed by C.  However, not with modern processors (or more importantly, modern computer architectures) which would distract.

* Coffeescript, Processing, other front-ends:  hiding stuff that you actually do need to know about is different from not giving access to stuff that you don't need to know about (Java's model).  Distracting.

* C# / Mono: Not actually a bad idea as a learning language, to be honest.

* Pascal, Modula-2, etc.: Looks nice, but suffers from the same "hiding stuff" problem.  You have to teach how memory management, because although the language disguises pointers, it doesn't negate the need for explaining pass-by-reference vs. pass-by-value early on.


Anyway, my 2p.

Tom