martes, 2 de octubre de 2007

Scripting languages

It seems that with Python and Ruby, we are getting into the Polyglot era of the late 80's.

But we know that era ended in the mid 90's, because when there is a language war, only one of those languages can survive. At that time, there were 2 main languages: C and Visual Basic. Visual Basic though had a pretty short life. C was replaced by C++. C++ is menaced now by Java.

Today Java and C# are the main contenders. Ruby is a very distant third.

But the right language is Java, because it gives you all the control you need, and even database engines and operating systems are written in this open source language. Alpha Geeks are moving away from Microsoft.

But I know that several people will rush into this scripting languages and marvel at their ability to write quick code. But eventually that code grows and it is not manageable anymore. It lacks abstraction, and a language has to measured ny the amount of abstraction that it allows its users to apply, not because they are quick and dirty.

A few years later, let's say 2009, they will be sorry to have so much code written in scripting languages, buggy, and impossible to fix. Other companies will be smiling because they wrote everything in Java using AOP.

martes, 25 de septiembre de 2007

Erlang is not the only language for concurrency and parallelism

Erlang is not the only functional programming language for concurrency and paralellism.

In fact, all functional languages are designed for concurrency and paralellism.

The main reason is that functional programming assumes that input variables can't be changed and the only way to communicate the computation of a function is to return a value, therefore all side effects are eliminated and therefore all functions can be evaluated simultaneously without side effects.

In Haskell, you can even pass the world around.

Variables are also functions

"What?" I hear you say. Imagine you can define in Lisp a function like this:

(defun f (x) (2) )

It means that no matter whata parameter you pass to the f function, it will return 2. This is the same as a constant in C or Java.

But in Lisp you can change the function at runtime:

(defun f (x) (3) )

So it is more like a variable.

Most of the time isp is presented in the opposite way: Functions are first class elements, so that they can be passed as parameters, assigned to variables and returned from functions. Actually each of them implies the other 2.