Parlez vous Anglais?

Some interesting responses to my post yesterday about the evergreen VB.NET/C# debate.

Andrew from Mindscape makes the point that every different language has “different levels of expressiveness and also different aesthetics.”

Quite right.

He posts this Ruby code snippet …

10.times {|i| puts i }

… and asks “Which do you find more beautiful?”.

The VB.NET equivalent is:

For i As Integer = 0 To 9
Console.Write(i)
Next

I agree that the Ruby code is beautiful.

However, I’m not sure that is the right thing for us to optimise on.

How about optimising for readability? Most code is read much more often than it is written. When we’re designing databases we understand what this means. Adding an index to a table adds a small cost to every write, but it’s worth it in situations where there are many more reads than writes. But we don’t seem to apply the same principles to the code we write.

I’ve worked on a few different applications now and can’t think of any where the limiting factor was the number of keystrokes in the code. And as a couple of people have pointed out a good IDE setup can significantly help with this anyway.

MVP Alex calls the VB syntax “ridiculously clumsy”, and points the finger specifically at keywords like Overridable, NotOverridable, and MustOverride.

I guess that depends on what language is native for you. For me, when I read ‘virtual’ (a term that can actually mean 1000 different things depending on the context) I have to translate that into ‘able to be overridden’ or ‘overridable’. I’m not the only one.

You say tomato, I say tomato.

And that was really the point I was trying to make.

An argument between two developers about which language is “best” is like a debate between an Englishman and a Frenchman. Each will prefer their own language. And each will be right because they will both be able to express themselves best in their own native language.

And again, while the debate continues, important problems remain unsolved.

:-)

2 thoughts on “Parlez vous Anglais?”

  1. Ill go for self documenting code any day.
    I would bet that if you were to show either snippet to a group of non programmers the VB would be far easily digestible.

    I think the ruby code looks clever but not really beautiful.

    Horses for courses.

  2. Okay so maybe “ridiculously clumsy” was a little harsh…

    and yes you are right I think beauty depends more on nurture than nature!

Comments are closed.