The best programming languages
Posted by alpheccar - Jun 13 2006 at 18:06 CEST
It is of course impossible to choose, in a objective and absolute way the best programming language. Choosing a programming language is dependent on too many things. A language which may be very good for a specific use may be the wrong language to use for another task.
So, my choice of the best programming languages (I have chosen 3) is likely to look very subjective. Lots of readers of this blog will surely disagree with me. And the criteria that I have chosen to use for my selection are also very subjective and fuzzy. But, although my choices are difficult to prove and justify, they are the results of practising a great number of programming languages.
I have chosen as the best programming languages : Common Lisp, Smalltalk and Haskell and I am going to try to capture the essence of each of these languages to try to explain why I am thinking they are the best ones
Common Lisp
As it is the case with the next two other languages that I think are the best ones, Common Lisp is a rich and complex language and attempting to describe it with a few unifying principles is doomed to failure. But, I would say that the essence of Lisp is that Lisp programs are datas and the Lisp system is a Lisp program.
So we have a totally reflexive system. And that's possible because (but not only) there is no syntax. Since there is no syntax it is possible to build Lisp programs which are extending the Lisp system ang among them we find the famous Lisp macros taking a Lisp program as input and generating a Lisp program as output.
This system can customize itself. The new functions and macros built by the user are integrating themselves with the system in a very coherent way. When looking at a user defined abstraction, you cannot say if it is something added to the system or that was in the system originally. For instance, the Common Lisp Object System is not an extension to the Lisp system : it is always Lisp and not a new version of it. CLOS is a Lisp program.
So, in short, programming in Lisp is programming the programming language. Extending the concepts, the vocabulary to be able to describe problems and their solutions in a higher level language which makes program shorter, easier to understand : in short more elegant.
Smalltalk
Lisp is based upon the idea of "function" application. (The quotes around function are important). It is the execution model : you apply a function/operator/macro to a list of datas. The "function" can have side effects and return some data
Smalltalk is using a totally different model. The essence of Smalltalk is that you send messages to objects and everything is an object even blocks of code. That's all. When in Lisp you need to introduce a special operator for conditions because the application behavior is different from functions (you must not evaluate all arguments of the condition but only the ones corresponding to the true condition because of side effects), in Smalltalk you use the same unifying principle.
To check a condition you send a message to an object. The message contains two block of codes (which are also objects) and describe the condition to be tested. According to the result, a message will be sent to the corresponding code block to ask it to evaluate itself.
In Smalltalk, like in Lisp, one could say there is no syntax. There is a little bit more of syntax in Smalltalk but not that much. Smalltalk is essentially a syntax free language. The messages are what makes the vocabulary of the language.
Here again, most of the language is defined by libraries and Smalltalk programs. Smalltalk is built with Smalltalk and here again user defined abstractions are integrating themselves coherently with the system and you cannot say if they were added to the system or if they were in it originally (from an user point of view).
Programming in Smalltalk is also, but in a way different from Lisp, programming the programming language.
Haskell
Haskell is quite a different beast from the two previous languages : it is statically typed. Haskell is also based upon function applications. But, contrary to Lisp, the functions are pure ones that have no side effect. And to avoid the need for special operators (for the condition ...) the arguments are lazily evaluated. Here again, there is not much syntax in Haskell (but more than in Smalltalk).
Haskell is not a programmable programming language (unless you look at extensions like template Haskell) but there are enough abstractions in Haskell to easily build domain specific languages with it.
The essence of Haskell is that there is no notion of state, no notion of time. It is purely functional. One could say that it is a defect of Haskell since time and state are essential notions to describe the world. But, the idea of time, the idea of sequencing can be built upon a purely functional system and we are led to monads.
Monads are not a hack of Haskell that would be required because of a model which is missing an essential feature of the real world. Monad are the recognition that the idea of sequencing operations can be formalized in a purely functional language.
The monad is an abstraction allowing to create new control structures and, in associations with the powerful type system of Haskell which makes possible elegant overloading of operators, it is possible to easily build new abstractions that allow to customize the programming language.
My idea of a best programming language
So, it should now be clear. For me a good programming language is the one which is not restricting the creativity of the developer. It is a system which is allowing the developer to think freely but freely does not mean without method and rigor. A good language is essentially a language which can be extended in a natural way and whose type system (static or dynamic) can prevent runtime errors that are too common in languages like C for instance.
To be polemic, you may now understand why I prefer Ruby to Python. I think that Python is more regular in its syntax than Ruby but less regular in its concepts. And the less regular Ruby syntax is clearly compensated by the greater freedom of expression allowed by Ruby.
Yes, I know : both are very good languages. The Python default implementation (CPython) is currently faster and their support for thread and unicode is better but I nevertheless think there is more elegance in Ruby. And that should not be a surprise because Ruby was developped as a kind of simplified Lisp/Smalltalk.
Yes, you can do metaprogramming in Python. Yes, you can also program the programming language. But, that's not the style of programming favored by this language and it is not the culture of the Python community.
Unfortunately, Lisp, Smalltalk and Haskell are too different from most programming languages currently used in industry and taught in schools. They really look like alien technology to most developpers.
As a first step towards this alien technology, I would advise Ruby for the dynamically typed side and Ocaml for the statically typed one. Ocaml is much easier to learn than Haskell since it is not pure : side effects are allowed. It has also an extremely good compiler and development environment. I just find it to be less elegant than Haskell.


Critical Factors
Posted by oscar duron - May 28 2008 at09:40 CEST
Remember Einstein, E=mc2, He makes me think, The best programing language is the human language, and even in our language we have big problems to express many concepts and ideas, not say describing problem solutions. So, the best programming language must cover, very well, critical factors for the average human like me. First Factor . Documentation, (the best, complete, detailed, concise, with samples, etc) Second . Support (Critical bugs instantly fixed instead going to version 2,3,..., with more changes, more complexities, new bugs) Third . IDE (The best IDE possible, with debugging) Fourth . Always backwards compatible or autoupgraded.(Not deprecated any more) Add, remove Factors, choose the critical factors, then we will see which is the less worst language, because in fact there is no best programing language at all, up to 2008, as there is no best human language, or which is the best philosophy language, which is the best for religion? which is the best for moral, which is the best for love? then we see all you want about machines and money handling languages.
Posted by alpheccar - Jan 17 2008 at18:08 CEST
It looks like the sentence : "Lisp has no syntax" is causing trouble and people misunderstand the message. I agree the sentence is fuzzy specially if taken out of its context.
The meaning of the sentence is : Lisp syntax can be customized as much as you want (macros...). Lisp is not forcing you to use special syntactical constructs like the ones you may find in other languages. And, the customized syntax cannot be distinguished from the original one since there is no special notation to introduce it.
So, the syntax is not an inherent property of the language. At least, much less than in any other language where the syntax is frozen. There is just a very small syntactical kernel and lot of freedom on top of it.
Remark
Posted by she - Jan 17 2008 at08:51 CEST
"How could other programmers understand each other if each of them have their own language ?"
That is already the case if you write a program in a "specific style".
If i see code of other people, I instantly are confused. Then I slowly have to figure out what they wrote, why, and how. This is a tedious process.
It doesnt matter if they use their own language or a programming language, because it is so easy to create new methods and use them. Things can get very complex quickly.
Using a natural language is in NO way different from using a lot of custom methods anyway, so your reasoning is unfair. Understanding programs written by others will ALWAYS be difficult.
And this is why I am a documentation fanatic. I make my documentation terse in the program, but if there is a bigger program, I offer a tutorial with explanations, and I ensure that this tutorial is sufficiently good that everything what is said there will WORK as well. This is the most important part - to teach other people. And to explain.
Posted by alpheccar - Sep 09 2007 at10:24 CEST
Correction done.
Posted by Ramon Leon - Sep 09 2007 at06:40 CEST
Good choice in languages, I also consider those the top three. However, please correct you use of the word Smalltalk, it's one word, not two.
Posted by alpheccar - Sep 13 2006 at19:49 CEST
I totally agree ! Forth is very beautiful. Really cool for embedded systems. I don't know Joy so I'll have a look at it. Self like other prototype based languages shows how classes can be annoying. I don' t like Oz. I find the syntax too horrible and I don't see any elegance in it. They have put many paradigms in it but I have problem to discover the unifying principles.
Caml is powerful, great for industry but I agree : there is no elegance in it and you tend to rely too much on the imperative features in it whereas Haskell force you to think functional and it is a good thing. I tend to consider Ocaml as a first step towards Haskell for people coming from the imperative world.
My post was about elegant languages but also about the ones allowing to implement domain specific languages (and surprise! it is related) So it answers also the comment from Robert.
Posted by e1 - Sep 13 2006 at15:22 CEST
Couldn't resist replying :)
I think Haskell, Smalltalk and Common Lisp are great choices. I personally prefer Scheme to Common Lisp but Common Lisp is close enough. However I'd include a few other languages, all of which have some unique features not found in other languages, namely - Forth (tiny - often full blown implementations fit in as little as 8-32k, as extensible as Lisp, only much lower level and closer to the hardware - very crude and yet very elegant at the same time), - Joy (what Lisp would have been like if it was based on combinatory logic instead of lambda calculus), - J/APL (array programming languages), - Self (Smalltalk without classes - but not without objects!), - Prolog/Mercury/MozartOz (logic based languages).
I wouldn't include Caml - if I understood the intent of the original post correctly it was to pick languages that are clean, have certain elegance and have certain unique properties not found elsewhere. Caml is a great language, accessible, easy to get into and a great first functional language for someone already familiar with imperative languages. But that aside it doesn't actually offer anything over Haskell and is nowhere near as elegant. As far as object oriented programming goes again, Smalltalk and Self are much nicer there. JoCaml is more interesting than OCaml in this context due to Join calculus but it's not mature enough as a language (or at least the implementation is out of date). On the other hand there are a few libraries on the net that add Join patterns to Scheme.
As for Ruby and Python, to me they feel like a significant step backwards from Smalltalk (whereas Self is a step forward).
Specialty programming languages
Posted by Robert - Sep 13 2006 at01:52 CEST
Why do all purpose languages(C, Python) get all the bloggers attention and nobody seems to talk about special languages for certain subject areas(such as SQL)?
The best data crunching programming language in the world is available to try out at my blog:
www.my.opera.com/datahelper
check it out !
Robert
Objective Caml (ocaml)
Posted by griffindor - Sep 03 2006 at15:16 CEST
I would vote for OCaml, even if Haskell is great. A lot of progress have been done since Common Lisp in research that have been included in objective Caml. Programming big application with OCaml is much faster than in every other language because one a caml program is ok for type chacking, it has really few errors. A Caml program is really easy to maintain.
The other adavntage of ocaml is that it is very rich (has a lot of features). You can choose the programming style you want and mix them safely, making programming very easy.
Hi Pankakke
Posted by alpheccar - Jun 14 2006 at21:26 CEST
Hi Pankakke,
Happy to see you still read my blog even after this long phase of silence. What do you mean by "titles sucks" ? The title of this post or you don't like how titles are displayed on this new blog ? Or you don't like title in comments ? Yeah, I know, I still have some improvements to do. I'll see what I can do for bold in the comments.
Saying Ruby does not support Unicode is true but partially. There are workaround. This new blog system has been developped in Ruby On Rails because it was the fastest way for me to build something from zero during my spare time. This blog is supporting Unicode and is offering different versions of the page (but also of the posts) : english, french etc... Of course, there is no automatic translation so I have to write several versions of the post if I want to display a different version on each page. For instance, this post is in English only so only the english version appears on the French and English pages of the site. But the post "New blog" has also a French version which is displayed on the French pages.
And for the tags, I have also a stemming algorithms working with english, german, french etc... which is useful to gather several tags together like mathematic and mathematicS but it is more complex with verbs and accents.
I realize my current implementation of "Recent Comments" has a little problem. It is assumed to display only English comments on english pages and french ones on french pages. But that's a bit weird because if the post is English only it will appear also on the French pages and display "n comments" but these comments are not visible in the "Recent Comments" box of the French page. I'll have to correct it. Any other suggestion is welcome.
For Python, have you had a look to Django ?
Metaprogramming is a very good thing but you have to experiment it to realize this. It is true that it may be frightening. There is no problem of comprehension between programmers. No more than with function libraries, classes etc... It is just offering another abstraction level. You don't change the syntax but metaprogramming allows you to avoid repetition as much as possible. Regularities and patterns cannot always be captured by functions, classes. Sometimes you really need metaprogramming to factor some regularities and pattern and avoid having to write again and again several variations of the same kind of abstraction.
Metaprogramming is all about creating new abstractions to capture more complex kind of regularities in software.
Titles sucks
Posted by pankkake - Jun 14 2006 at20:32 CEST
Ruby doesn't support Unicode. That's planned for 2.0, but until then... That's quite self-contradictory, as Ruby on Rails is one of the most popular and one of the best frameworks, while Unicode is becoming a requirement for international websites. I plan to develop a really large website (gigantic database / heavy loads), as of now I think I'll use Python (maybe with Clearsilver, maybe with CherryPy).
By the way, I don't think that meta-programming is a good thing. Sure, it's fun, and I like to customize everything. But is this really necessary ? How could other programmers understand each other if each of them have their own language ?
And bold text in input boxes is ugly.