Thursday, August 28, 2014

Coding and Cooking

A young neighbor said that she is taking an introductory programming class. Of course, I asked her what language it used--failure to do so could lead to them taking away my pocket protector. When she said C++, I stared for a minute. I said, Well, it's a big language. And I remarked on the growth between the two editions of The C++ Programming Language that I had owned, the first probably under 300 pages, the next, purchased at most five years later, over 500. I find that the latest edition, published this year, has 1386 pages.

Large books on programming languages are not unusual. However, C++ is a tricky beast, a tool designed by a very proficient programmer for his own kind. The beginning programmer can easily discover that the runes in the small print actually said "Here be dragons" or "Achtung: Minen" or "Chien Mechant", or indeed have to puzzle this out from a two-page error listing. I don't think that I would use C++ in an introductory course.

For what it can do, C++ is excellent. However, of all those employed as programmers, a small fraction need the facilities it offers, chiefly the ability to combine low-level access to the hardware with a high level of abstraction. Most of them can work at a remove from the hardware, as with Java and C#, or "scripting" languages such as Perl, Python, and Ruby.

It is certainly useful to be able to work at all levels of the software stack, however much one may stick to one particular level. I am grateful for the chance I had to learn assembler and C, and make gaudy but not too costly mistakes as I figured out about effective addresses and registers. However, I have worked with consultants who probably couldn't give a five-minute talk on pointers but are very productive with the higher-level languages they use. Plenty of the students intimidated or simply flunked out by C++ might be useful programmers, and eventually capable of tackling C++, if they started with something like Python.

I shared these reflections with a couple of friends. One responded to agree, mentioning the case of a young relative who had suffered pointlessly through half of a C++ class.

Michael Pollan, who writes about food, devoted some of his Omnivore's Dilemma to a meal beginning with the shooting of a wild pig. I believe that I read a bit of this chapter in the New York Times Sunday Magazine before I was called away to do something else. Or maybe I found it remote from my interests. I like Pollan's writing and more or less agree with many of his ideas, but have no urge to hunt my own pork.

Competence in programming is good for the individual, who becomes more employable, and for society as a whole, which nowadays can use programmers. Competence in cooking is good for the individual, who will generally eat better and weigh less, and for the society as a whole, which has member less likely to suffer from the ailments that accompany obesity. So, more of us should learn to code and more of us should learn to cook.

If instruction in cooking began with shooting and butchering a pig, how many of us would learn cooking? And the beginning student does not approach C++ with superior firepower. It is not a matter of lying in ambush with a rifle, it is a matter of contending in mud or thicket with a tough opponent, on terms of near parity. Odysseus got away with a scar when he went boar hunting.  How many of the students will?

No comments:

Post a Comment