Friday, October 31, 2008

Languages

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration."
Edsger W. Dijkstra (SIGPLAN Notices, Volume 17, Number 5)

If you think about it, and please do just that right now, then you'll probably notice that you use your native language to facilitate the thinking, at least to some extent. Taking this observation to the next step, how much does our native tongue influence our thought patterns, and how we perceive the world around us?

This is not a new question. There's even a theory in linguistics which studies this question, called the Sapir Wohrf hypothesis. In fact, George Orwell, in his classic book "1984", has a whole new dialect, "Newspeak", introduced by Big-Brother to aid in preventing "thoughtcrime". This imaginary language is unique in that it attempts to reduce its vocabulary, thus intending to limit thinking patterns.

A couple of years ago I heard a lecture (in hebrew) by Physicist turned Computer-Scientist, Prof. Naftali Tishbi, on some of the research he's conducted on languages and their affect on thought (and vice-versa). Since then, the subject has been sitting in some corner of my brain.

A couple of examples:
  1. When a procedure that I already know is coined, I can understand and use this procedure much more easily. For example, in Origami, the term "Double Rabbit Ear" allows my brain to much more easily choose an appropriate course of action, rather than just remembering some sequence of folds I've done before. In programming, that's exactly what Design Patterns do. I've used the Factory pattern before, but coining it made it more accessible cognitively, and it's now much more easy to notice when this pattern is appropriate.
  2. When attempting to solve a programming challenge, the choice of language affects the solution. This is taken to a very interesting extreme in LISP, where the first step to solving a problem is to create a new language tailored specifically for it.
There is no doubt that what programming languages a developer knows critically affect the quality of the solutions he'll be able to come up with. Until I learned Perl, I wrote simple text processing tools in C. The results were buggy programs which took too much time and thought to write.

But it is much deeper than this. A programming language affects how we even think about problems. Knowing several programming languages is important in developing our own minds and allows us to better think about problems. This is not new. Edsger W. Dijkstra already talked about this in his excellent 1972 lecture, "The Humble Programmer".

So, my resolution for the following year is to learn two new languages. While I think I know enough of Perl to get what I want done, I'm no expert in it, mainly because I don't like too many $ and too few letters. That's why I'm going to spend the next year studying Python. And I intend to really study it, inside-out.

I have a full-time job, a wife, some non-programming hobbies, an obligation to write a computer game, but I intend to follow through.

Funny comic from www.userfriendly.org, August 15, 1999

The other language I'll be learning is Japanese, by the way.