I’ve recently started reading The Structure and Interpretation of Computer Programs - one of the textbooks for MIT’s electrical engineering and computer science degrees.
One thing that’s immediately interesting to me is how challenging the first year introductory text is. The second thing is how well the book is thought out. I know how difficult that is, having written a reasonable amount of a book myself for the Squid User’s Guide.
The third thing I’ve noticed is how years of coding predominantly in “the {} languages” (Perl, and occasional bits of C, Java, etc) make it difficult for my brain to parse scheme/lisp syntax like this:
(define (abs x)
(cond ((> x 0) x)
((= x 0) 0)
((< x 0) (- x))))
My brain also encounters similar pain parsing ruby (though it does use {braces}):
5.times { print "Odelay!" }
and smalltalk:
a := [:x | x + 1]
If you’ve ever learned another spoken language (and I’m not referring to chatting with a programmer-friend in Perl with statements like “oops - s/oskar/fred/g in that last statement”), you’ll probably remember the first time that you started “thinking in the new language”.
Right now, I’m not “thinking in ruby” or “thinking in smalltalk” - I go through a mental process that’s very similar to reading a new language:
- Change each word to it’s English equivalent (In the case of a programming language, convert the tokens and keywords to some other language)
- Rearrange the words so that they make sense in English - if the direct translation is “couch sat on by man”, I’d rearrange to “the man sat on the couch”. For more complicated statements, I’d have to try out multiple rearrangements, until I find something that makes sense in the sentence’s context.
The process I have to follow with new programming languages is pretty similar to the process of converting from one spoken language to another.
With time, no doubt, I’ll be “thinking in” these programming languages. But the only way to do that isn’t through reading the language - it’s by writing the language.
Luckily, in this process I don’t have to upset people with my poor pronunciation and grammar.