or: The Elegance of Programming
It is a funny thing I realized in German class that the school system, CS education and teaching programming is doomed to fail. But all I did was to ask my German teacher how we could learn to abstract.
She had no answer, and I couldn’t think of an effective way, either.
Today, I read in the papers that German students “learn nothing in mathematics in tenth grade”. And I agree, it’s true: when you reach grade ten (that’s about 16 years), you stop calculating and start something that’s far more like “real math”: analysis, linear algebra, a (far too small) bit of statistics. The whole point in learning this at school is to learn how to abstract, in a mathematical sense. Sure, few people may really need it later, but most will not. And don’t even try to ask how it is useful: even teachers can’t figure out real-world usages for all cases.
Accordingly, the students that can abstract usually don’t have much trouble with this. The others do.
And it’s not only maths, that’s just where you notice it first. It’s the same in languages. After you can read, write and speak, you now need to prove you actually understand what you read. It’s not by coincidence that you can (and must) analyze both texts and algebraic terms.
Students that are bad abstracters (and this is not meant derogatorily, see below) often are good in, say, German at the lower classes. They write nice compositions about their holidays, can memorize the spelling rules to pass the dictations, and so on.
Often, trouble starts when you begin interpreting poems. If you look closely, you’ll notice an interesting change: students that used to be good at German get quite a bit worse, and students that were not so good get quite a bit better. At least, that’s what happened to me and some of my friends.
Suddenly, I became a lot better in German class. At first, I couldn’t figure out why. Maybe it was because of the new teacher we’ve got. Three teachers later, I can tell you it likely wasn’t. The focus of expectation just shifted: they don’t care as much that you can tell about your holiday, but that you can understand and think about what you’ve read.
And, in essence, that’s the thing you are supposed to learn in college or the German Gymnasium. It happens in just about all classes: you can’t stupidly learn by heart about birds and fish in Biology anymore, you need to understand. You can’t simply paint nice pictures for art classes anymore, you need to analyze famous works. You don’t just translate Latin texts, you need to interpret them. You cannot even simply run fast in physical education anymore, you need to understand how you efficiently train (and grokking our PE handbook is far more difficult than translating Latin texts, trust me). You can start doing “computer science”, which maybe “only” is elementary Pascal programming. But for all these things, you need to abstract.
Being able to abstract is the most important thing, because it multiplies our brain power. Alexandre Borovik writes in the draft for Mathematics under the Microscope:
In our conscious and totally controlled reasoning we can process about 16 bits per second. In activities related to mathematics this miserable bit rate is further reduced to 12 bits per second in addition of decimal numbers and to 3 bits in counting individual objects.
It is completely obvious that we need to fit big ideas into these few bits to be successful thinkers, by omitting what’s irrelevant.
Since one of the areas in which abstraction completely matters is CS, Paolo Bucci, Timothy J. Long, Bruce W. Weide asked in 2001: Do We Really Teach Abstraction? They conclude:
It may seem that an approach based on mathematical modelling and formal specification is premature in CS1/CS2. However, in our experience after four years of teaching this approach, it is not.
They reason because of this that teaching a very mathematical and formal CS helps the students to understand abstraction better. However, that only works because of the former exposure of the students to abstract mathematics. It does not really solve the problem, but merely shift it: “If you are bad in CS, your math teacher failed.”
Except nobody I asked knows how to teach abstraction. One probably can learn to abstract better on his own, but that is really hard work. For example, I think I became a better programmer by learning functional programming. And functional programming is far much more mathematical than, say, imperative programming (or even the OO they often teach). I was able to grasp FP quickly because I knew how to apply my knowledge of mathematical abstraction—and people that struggle with FP struggle with mathematical abstraction too. I think math classes merely sieve the students by their ability, and don’t enable them.
It turns out they can’t.
My German teacher said students are expected to know how to abstract at the age of 16. I don’t think they’ll wake up on their 16th birthday and suddenly know how to abstract. But the age seems right, it’s probably one of the reasons young people (around the age of 12 to 16) often start programming in imperative languages. The ones they use (like Basic) don’t allow for high abstraction and they can understand them better.
Chaitin directly related the elegance of an program to it’s length. Given abstraction as compression, that means the shortest program is the most abstract. Or: the most abstract program should be the shortest. By conclusion is every language, for which there is an obfuscated program that is shorter, an inelegant (or sub-optimally elegant) language. The mistake in this consideration is of course that the definitions of abstraction make the program longer. Still, there is something to be learned from this: the harder it is to compress a program, the more abstract it is.
In order to judge persons that are unable to abstract well, a further question needs to be answered: Does ability to abstract equal intelligence? According to the Hutter prize (in direct relation to Kolmogorov complexity) it is: “If you can compress the first 100MB of Wikipedia better than your predecessors, your (de)compressor likely has to be smart(er).”
Personally, I think that being intelligent makes you able to abstract well, but not necessarily vice-versa. I don’t think both are innate, and only partly heritable. Neither can be taught, but both can be learned. What’s left is the question of how to do it.
In his 2003 keynote, Abstraction – is it teachable?, Jeff Kramer provides a solution. He cites Jean Piaget that students from seven to twelve years have “some ability for abstraction with training”, however, with twelve years and more, “[o]nly 30% to 40% of teenagers exhibit ability for abstract thought, some adults never do!”. Jeff Kramer concludes that abstraction has to be taught indirectly and, just like above, by use of mathematics, formal modelling and analysis.
I think the age of 7–12 therefore is unbacked at our schools with respect to abstraction. We need to start teaching it earlier indirectly, when training still works. At later ages, these abilities can only be exercised, but will not uprise.
NP: Pearl Jam—World Wide Suicide