Tuesday, September 27, 2011

Two Reasons Your Favorite Programming Language Becomes Cumbersome

Regarding "Is Your Programming Language A Burden?", a couple of days ago, a reader asked me:
“How can I find a language more cumbersome the more I use it?”

Nice question and the answer is quite simple:

  • The first reason can be that the language was born cumbersome, but we didn’t have the fine taste to recognize its useless complexity. 
Let’s take an example: think about String class in Java or C# you know it’s final/sealed, you cannot extend it to open its behavior. Moreover you cannot modify it because it’s integrated with the language (grrrrr). I can bet when programmers realize those obstacles they become aware that language holds their creativity.

  • The second reason is about a language born simple, but release after release, version after version new constructs are stuffed in and finally it becomes bloated.
Look at  Java history and pick your top worst updates.

In conclusion, the more you play with a language the more you discover if it solves your programming needs or if it’s only a parking brake.

There is a third reason of course: a language starts cumbersome and in the meantime grows with useless syntax additions, that's the worst case dear readers ;-)

photo by http://www.flickr.com/photos/reiver/

Friday, September 23, 2011

Is Your Programming Language A Burden?

Hi folks,
 How are you? I'm fine, coaching a bit, programming a bit, observing, planning.

As you are reading this blog, I guess your workdays look like mine: wondering who was able to write that messy code (it's you, last month, you know) but you are not an ordinary developer you study, you delve... and day after day, while you are improving, you have a feeling your programming language is slowing you down.

It's something I often see: at some point you feel the language doesn't follow your thoughts, suddenly the syntax becomes cumbersome, types are a cage, primitives reduce your ability to create concepts.

In "How To Choose A Programming Language" I talked about feedback and level of magic and I'd like to hear your voice: did you measure the feedback of your favorite programming languages? You can do it now ;-)
Tell me about it on Twitter @Varvello or Facebook or Google+ or wherever

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 {}as:Set”

I can select  {}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.