Thursday, September 15, 2011

How To Choose A Programming Language

Welcome back. It has been a long time since my last post, but I was on vacation than my fish was sick and I needed to take it to the vet and my neighbor's daughter got a round hair brush stuck in her hair and I needed to help her get it out and in addition I fell off a ladder fixing the roof on my house and I landed on my elbow and etc. etc.

Anyway, in the last post, Wordpress vs. Blogger II, I stressed the importance of feedback and how it’s valuable for a programmer to gather feedback from her daily tools. More the feedback is fast, more we learn and more we can tune our product. If we have a result back in a month we learn after a month, if we have it in a week after a week in a second after a second.

I also give you this tidbit: our brain is very fast, it reacts in a jiffy: some days ago I was looking at my wife struggling with a web page where there was a button that said: “to reload press here” so I told her: “look at the button, don’t press it”. I didn’t end the phrase yet and my wife started moving her mouse over the button, she began reacting immediately.
Brain’s feedback is really fast, to be more effective I should have said something like: “don’t press the button now it's useless".

But I’m digressing.

As a programmer needing to be productive, which kind of language should I use? Which criteria are valuable? Where should I start?

Let’s suppose on the web there is some hype about a new programming language and you are almost interested in it, so you bring a reference book, after which you should focus on three things:

  • Feedback: how long it takes from the first time you see a line of code on the reference to the time you have that line running on your pc. That includes: downloading, installing, configuring, compiling… (stopwatch at hand).
  • Feedback: how it’s easy to play with the language. Close the reference and spike a bit. Can you immediately have some results? Are error messages communicative?
  • And of course, Feedback: look for something more complex e.g. saving data of a web page on db. Does the language solve it in a couple of lines of code? It means it’s very powerful, but be careful, that’s what I call: Level of Magic. It’s not really a drawback per se but you should be aware that the language does a lot of stuff in a very few lines of code, if you have to change something, you’ll have to understand its behavior and actually that behavior is hidden -> high level of magic.

Now, I give you an example of the second kind of feedback. The example is not new, but it’s something that has been fascinating me for a long time.

Comments in Smalltalk are enclosed in double quotes:
“this is a comment”

Of course a comment can be like this one:
“example {1.2.3.3}as:Set”

I can select  {1.2.3.3}as:Set  and evaluate it, I can execute a comment and see the result. That comment is living, I can play with it... I can learn: fascinating.