What is it ?
Scala is a programming language designed by Martin Odersky at the Ecole Polytechnique Fédérale de Lausanne. It is both a functional and an object-oriented language, that is compiled to JVM and CLR bytecode, which means that the same code can run theoretically on Java and on native Windows platform.
The pages of the project contains a wealth of documentation on this language that has, to my opinion a lot of attractive features:
- it is functional,
- it builds on the rich Java platform,
- it is inspired by Haskell which is definitely the Best language of the world
Why Scala ?
There exists a rationale document explaining why scala was created. I will not rephrase what is written on the official site but rather give some arguments explaining why I choose to use Scala.
Functional programming will matter
Functional programming exists in mainstream software production business only in disguise. One of the most used and most well-known example of a functional-language-in-disguise is Excel (or any spreadsheet) and its macro features.
I believe that functional languages, or rather functional programming systems, will be the next big thing in the IT industry. This belief is based on the following facts:
- dynamic languages incorporating functional features (ie. first-class functions) like Ruby and Python are becoming more and more common. Mainstream languages like C# and Java have or will have closures ;
- functional languages gurus like Simon Peyton-Jones, Ralf Lammel and others are being hired by big players like Microsoft. I am not aware of similar examples with Google, Sun or others because I mainly follow what is happening in the Haskell community, but I believe the same must be true. They bring in their experience and skill in optimization and language design ;
- functional languages are much much more expressive than imperative or (traditional) object-oriented languages for most common programming tasks: one can do the same thing writing less code, sometimes by an order of magnitude ! Things that make a programmer's life simpler are: pattern matching on inductive data structures, functions currying and passing around, syntactic closures allowing proper encapsulation and nesting of computations, uniform handling of all objects in the language, generalized polymorphism (ie. on all parameters of the method)...
- some functional languages are becoming more and more common in industrial circles: Erlang and Caml are two examples of programming languages and systems that have been succesfully used in industry and some services (banking, I think) ;
- functional programming languages are now competitive in terms of performance, thanks to the advances in compilation techniques, language design and hardware speed ;
- FP may offer some interesting and much easier to use alternatives to threads for concurrent programming. Automatic parralelization may be easier in a functional context (not sure of this, but have a look at ParallelHaskell), other paradigms like message-passing, actors, software transactional memory are easier to use, implement or both in FP. And concurrent programming will certainly matter with the advent of multicore processors ;
- functional languages are elegant, and beauty will always matter.
Scala is "smart Java"
Scala builds on the rich, nearly infinite resources of the Java system, while getting rid of the stupid and clumsy syntax of Java. One can use all Java libraries and packages from scala, and vice-versa.
Java sucks
While I have been a dedicated Java programmer for the last 8 years or so, I am fed up with it today: I am talking of the language, not the system. For what I know, C# is no better and it does not seem to mix well with Linux, so this is not an option. I have been looking for a FP language alternative for several months and, while I am still in love with Haskell and did not yet totally get rid of the idea of making a compiler for the JVM.
I have looked at Erlang which seems promising but has one stupid flaw: it only supports natively ISO strings ! And it is not statically typed. I have looked at OCaml, which has also interesting features, mixing functional, imperative and OO traits, but I do not feel comfortable with the syntax. Scheme is nice, has a lot of good implementations, but you need a special keyboard with reinforced parens keys to use it. I looked for alternative syntax but nothing looked quite convincing. ce
©
2006-2007