You will find on this website publications about informations technologies. The content is available in french and english.

mardi, 28 novembre 2006

Languages war

A typical controversy subject, the programming language choice can somewhat appears as secondary. Yet, a language always brings its paradigms that will influence programmers whom use it. The most common programming paradigm in IT business applications are imperative programming and object-orientd programming. Functional programming stay confined to very restricted domain (research, geeks, etc.). The most known and old one, Lisp, did not really make a breakthrough. Nevertheless, Paul Graham talk about his success with Lisp.

The functional paradigm make a breakthrough recently

This breakthrough has its origin in :

  • The success of languages that integrate a functional approach. That‘s not the language itself which is popular but the possibility that are associated. Ruby is popular thanks to the fabulous web framework Rails, Javascript thanks to the Ajax phenomenon.
  • The functional approach‘s ease for parallel execution processing. Google and his implementation of the famous Map and Reduce is a perfect example (even if it is implemented in C++ and I will come back later on this point). With the generalization of multi-processorsmachines, this subject will become more and more major.

The Java language weakness

These spotlights pointing functional programming show up the weakness of the flagship language of these last years : Java. Although having several matured programming paradigms – namely imperative, object-oriented, generic from the 5.0 version and multi-platform – Java is cruelly missing the functional paradigm. The concurrent programming paradigm is fulfilled with the superb library integrated to the platform from the version 1.4 : java.util.concurrent. At last, Java is quite conservative concerning the typing discipline with a strong and static typing.
As a summary, the Java language weakness are (and I speak of the language and not of the platform..) :

  • static and strong typing are too conservative : Bruce Tate wrote an excellent article describing the different binding mechanisms (binding mechanism deals with link between a declaration and an implementation, often through a type) implemented in every programming language and he points the finger at the "common" Java frameworks like Spring and Hibernate. He describes theses frameworks as a replacement for mechanisms natively found in dynamic languages (on-the-fly byte-code generation, dynamic proxy, classes decoration). I want to show the famous picture from Dr Larson, that summarize very well the hearth of the matter :
  • no functional paradigm : a Java function is always linked to a type and is not a first-order object. It is not possible, in Java, to pass another function to a function without using a type (The closure concept does not exists). Steve Yegge, always present, has signed a brilliant post on this subject : Execution in the kingdom of nouns.

The Java platform power

The Java platform and not the language itself, is still one of the most powerful execution platform. The Java ecosystem is one of the richer at this time with a very high number of external librairies. The advanced platform characteristics with Java EE are mandatory for high-demand environment (clustering, distributed transaction, security, messaging, web services, etc.). The Java platform stay adaptable even if the processus can be lengthy and restrictive. The JSR-223 is just aiming at defining the interaction interfaces with a dynamic language (often called script language) while the JSR-241 define a language that merge the characteristics of Ruby, Python and Smalltalk (quite ambitious !). At the same time, projects like JRuby, sponsored by Syn, or Groovy, aim at using the Java Virtual Machine as an execution container for this languages.

The competitors

Java is currently sustaining a strong push from more advanced languages. This push is due to their inner capability but also from theirs platforms. Theses competitors are named Ruby, Javascript or Groovy. I leave aside Smalltalk , Python and Lisp which are missing the small "flash" that can make them really popular. I also leave aside the 8512 minus 7 other programming languages that human being has spawned…

Ruby

Ruby is the start of-the-moment, notably thanks to a web framework named Ruby on Rails, which known how to exploit all the Ruby dynamic language possibilities and also be very pragmatic (configuration by convention, code generation, common directory structure). Sun has hired the two main JRuby project developers aiming at offering a Ruby interpreter written in Java and allowing an interaction between these two languages. Grails can be considered like an example of how a dynamic language and an older “host” language can interact.

Groovy

Groovy's strength is his proximity with the Java syntax and his already deep integration with the JVM. The JSR-241 deals with the groovy's standardization. The Rails equivalent is also available for Groovy and is named Grails.

Javascript

Javascript is an advanced language despite the "web gadget" a priori and is coming back on the foreground thanks to the Ajax phenomenon.

Forget the programming language and concentrate on design

This programming languages inventory is for me an introduction to the essential activity : Design. The languages and the different paradigms must be considered as an intellectual tool and not as a simple way to implement a processing. Whatever implementation you choose you will succeed to surpass, with more or less readiness, the language weakness. So, you can implement a functional approach with Java by giving interfaced objects, do meta-programming with reflection and on-the-fly byte-code generation (this is what do Hibernate for example), do late binding with Spring.

The most obvious example is still the Google‘s search engine‘s implementation that use techniques from the functional paradigm to address their problem (parallel execution processing on a large amount of data). The implementation is done with...C++, a language far away from the functional paradigm. Another quite well known example, the implementation of the X windowing system was designed in an object oriented manner but implemented with the non object C language.

I predict a handsome future for the dynamic languages, it is in the logical way of the language evolution towards a more and more expressiveness power. Which one will carry off ? ...difficult to say. I think Ruby has good assets and enjoy the (light…) Sun‘s support. Javascript and Groovy have a very close syntax with Java and can be outsiders. Wait and see.

I intentionnaly omit C# from this comparison because it is very close to Java and then is not relevant to this comparison. Also, it makes me avoid to get in the traditionnal Java vs .Net war.

Technorati Tags:

Posted at 8:33 PM in en/Technologies/
portage salarial freelance