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.

Saturday, October 11, 2008

Active Learning

"Reading, after a certain age, diverts the mind too much from its creative pursuits. Any man who reads too much and uses his own brain too little falls into lazy habits of thinking."
Albert Einstein

It's been several years since I realized I don't know anything. Occasionally, I make the mistake of thinking I know something pretty well. Reality always reminds me that I don't, usually using a sledgehammer. So I keep trying to learn. I read blogs and even (gasp) books. In fact, I even spent four years in what some people say is a pretty decent university. I even managed to surround myself with people who are way smarter than myself at work.

The thing is, you can only learn so much from other people. Consider Tom for example. He wants to learn a bit about thermodynamics and the heat conductivity of various substances, say, a human hand. It doesn't matter how much he reads Fermi's book, or even how much he hears lectures by distinguished professor Mom. In fact, said professor told Tom just last week that touching fire is dangerous, because fire is very hot. Now, Tom is a very intelligent boy for his age. His mother told him so, as a matter of fact. Yet, all of the theoretical knowledge he's learned won't stop him from trying to touch the flame with his hands. Only after such an experiment will Tom really understand that the heat conductivity of the human hand is, well, ehm. It hurts. That's what he'll finally learn.

My point being is that the only real way of learning something is by doing. That's why work is so much more tiring than a university lecture. In a lecture, you sit passively and listen. You can cover more material faster this way, but you don't really learn anything this way. Work has that annoying aspect wherein you actually have to work.

I'm not against reading books. I really love books. I am, after all, a nerd. Reading books is important. But it's not enough. You have to learn things the hard way.

So I'm going to write a game. I don't know too much about it yet, but that's what I'm going to write in the spare time that I don't have. A game is a good subject, because it covers nearly every imaginable aspect of Computer-Science and software development. I've already finished the dreaded Requirement gathering process. Here are the games requirements:

  1. It should be a game.
  2. I should finish it.
That's it. Now to start codi, em, I mean, designing. Yes, that's what I mean. Designing.