Young people occasionally ask me whether language X is something they’ll need to make computer games, or what they should learn if they want to become programmers. And what language should we teach in school?
I learned UCSD Pascal in school. When I came to university, freshmen were taught C++, and by the time I was in a teaching position myself, the language of choice at almost all universities had changed to Java, so that’s what I taught.
Last year opened my eyes a bit, though. I was interviewing prospective new employees, and several people fresh from school. A lot of candidates were weeded out because they admitted to knowing only Java – and despite numerous claims that this would happen, we still don’t make games in Java, and neither does 97% of the rest of our industry. C++ is the language.
While that was expected, the next group of people we weeded out were the ones that said they knew C++, because they’d taken it for extra credits in school, but still wrote most of their own stuff in Java. Some of them managed to get through to the interview, and failed our C++ test. And that’s where I realized, C++ is so significantly different from Java that it might be a really bad thing for us to teach students Java in school. It’s easier to be a good C++ programmer and then learn Java – beacuse in terms of things you can fuck up, C++ is the bigger problem, but if you master it, Java comes quite easy.
Schools like Java because they can skip over the whole issue of pointers, memory, headers, makefiles, templates and the general nastiness that comes with it. But frankly, if you never hear about memory allocation, pointers and makefiles, it’ll come as a huge surprise to you, which you then treat in one of two ways: you avoid it, and go back to Java, or you try to ignore it, and end uop with really, really bad C++.
Personally, I’d teach people some C first. The pure stuff. I can avoid talking about objects in lesson one (because printf is quicker to explain then std::cout and it’s crazy syntax). Something happens really fast in your program. Memory allocation, headers an Makefiles will appear just like they do in real life. And then, when that’s understood, I’d introduce C++, and when I then explain about templates, containers and classes there will be a collective sigh of relief, just like we sighed it when C++ first appeared. But the students will know that underneath, memory allocation still happens, linked lists are still linked by pointers, templates mean big, big headers, and Makefiles are a bloody pain.
Two things that Java doesn’t do well: Staged delivery of the concepts (instead you get them all at once just for a Hello World) and an understanding of the inner machinations.