Tuesday, September 04, 2007 4:48 PM
JeffB
What's in a language?
Language preference is a very personal choice among programmers. What I have found is that either people naturally gravitate towards a language or that one falls into a language on the job or early in one's development as a programmer.
Some would argue that it doesn't really make much of a difference what language you use and other language snobs such as
Paul Graham would argue that some languages are inherently inferior to others.
I happen to agree with Mr. Graham, as I have a strong dislike for languages like Visual Basic. And I truly believe that the language itself shapes and promotes the structure of the programs we develop.
I am still searching for the perfect language. The main candidates are
Ruby,
Python,
C#,
Lisp, and a language from the ML family of languages such as
F#. These fall into roughly three different classes of languages, with Ruby and Python both being dynamic/scripting languages, C# being a java/C++ imperative language, and Lisp and F# being more or less functional programming languages.
Of the two scripting languages, I am now leaning towards Ruby as a better option. Although, Python has a much larger community and I like the forced indentation as a way to promote code readability, it lacks certain features that some consider esoteric. In particular Python doesn't have full support for continuations or closures. A continuation is basically a way to jump back in time to previous point in the stack with all the state preserved and continue from point. Some possible applications are controllers for web sites. With continuations, one can reenter the controller at the very next line of code to execute, instead of the beginning of a function. Closures allow you to capture code blocks and the local variables that were set where they are created. The
Hole in the Middle Pattern is one example of a use of a closure. Python does have some lightweight support for similar features in the form of generators and single statement closures, but not being an expert in Python or Ruby, I am wary to learn a new scripting language that doesn't support features that I believe will come into more use. Some of the advantages of scripting languages shared by both Python and Ruby are that you can run and debug them interactively in an interpreter. You don't need a compilation phase and they support rapid development which is good for building support scripts and test scripts.
It probably is important for most serious programmers to learn one of the C++ family of languages, whether that is C#, Java, or C++. The main reason is that these have the widest reach right now and if you want a job as a programmer they are always good to know. C++ offers the most performance, Java is the most widely used, and C# is a good option for corporations who like the comfort of being backed by Microsoft.
That being said, unless you are dealing with raw performance as your greatest driver in language choice, I think the general trend in programming languages is more toward functional languages or languages that support some of the features offered by them. C# is grafting on some functional characteristics such as lambda expressions and the yield keyword. But, why settle for features grafted onto a C++ imperative language when one can go straight to source. This is where languages like Lisp and F# come in. I have used Lisp in certain projects in school such as writing a Sudoku solver using constraint satisfaction algorithms and it really got me out of the way I was used to doing things with. What I found, at the end of these projects, was a much cleaner organization had somehow emerged out of my struggling with Lisp. But I have heard interesting things about ML family of languages also like OCAML and F#, so I am now taking a look into them to see how they compare with common lisp.
At the end of the day I would recommend anyone to learn three languages from the three classes, above, a scripting language, a C++ family language, and a functional language. I think I have settled, on Ruby, and C#, and I am still deciding on Lisp or an ML based language.