Mind your language

from The Age
March 24, 2009

A fast-growing number of programming languages offer diverse benefits, writes Tim Anderson.

Diversity is coming back in the world of programming languages. Fourteen years ago, Sun introduced Java, with the mantra "write once, run anywhere", based on the fact that Java's runtime can be installed everywhere from desktop PCs and mobile phones to web servers and mainframes. Java usage soared, thanks to the backing of industry giants such as IBM and Oracle, and at one time it seemed it might be the only language a developer would need - although Microsoft countered Java by developing its own runtime platform, called .NET, able to run several languages, which was also very successful.

Java is the most popular programming language in the business world, but other languages are now growing. One factor is the web. "There is more serious attention being given to JavaScript and its offshoots, because it runs in the browser," says Martin Fowler, chief scientist at ThoughtWorks, which develops business software. Despite its name, JavaScript is different from Java. Adobe's Flash plug-in, the most common way to extend web applications with rich graphical effects, runs its own language called ActionScript, based on JavaScript. Apple's success with the Mac and iPhone is also having an influence, as the primary language for both is Objective-C.

It is not just a matter of new platforms driving new languages. "People are getting interested in the idea that they can use different languages to get different benefits," says Ola Bini, also at ThoughtWorks, who introduced sessions on emerging languages at the QCon software development conference in London last week. "The idea that one language is good enough for most tasks is a false notion."

The recent trend is towards dynamically typed languages, which use inference to reduce the amount of code to be written. Java, C# and C++ are "static typed" languages, whereas JavaScript, Ruby, Python and PHP (used by Facebook) use "dynamic typing". In static languages, the programmer must declare each variable's class (such as string, integer or list) before the program runs; in dynamic typing, it is assessed as the program runs. Fowler says Ruby is between two and five times more productive than Java. "You can just express yourself more rapidly in languages like Ruby and Python, and that gives you an edge."

Relying on inference is arguably more error-prone, but developers overcome this by creating tests while programming that verify the correctness of their code. Advocates of dynamic languages also argue that their code is easier to follow, making errors less likely. Also, today's computers have multiple processors, which means that software has to be able to split tasks into several threads that can execute simultaneously if it is to work at the greatest efficiency. "After working with C# threading, I never wanted to do threading again," said Microsoft's Amanda Laucher at QCon, explaining why her company has developed a new language called F# that is optimised for the purpose.

Erlang (erlang.org) is another example. "Many enterprises are using languages like Erlang to get better concurrency support in their systems," says Mr Bini.

Efficiency and productivity are compelling words in hard times. "Our business is growing during the recession," says Wendy Devolder, founder of Skills Matter, which offers training in alternative languages. Another benefit is that many new languages - Ruby, Python, PHP - are open source. "People like the fact that they can contribute and develop better ideas. With a lot of open-source products, although there may not be a formal support contract, there is actually more support because the entire community is helping one another," she adds.

These trends mean that developers may have to switch languages, or work in several at once. Is that a strain? "I think it is essential that you learn multiple languages," says Ben Summers, a developer and consultant. "Programmers who stick with one programming language for all their career just aren't learning."

Jason Standing, a programming contactor, says the pace of change is challenging, particularly in Microsoft's .NET world. "I am having a hard time figuring out where things are moving to because there are all these new features, add-ons and modules, and ways of doing things coming out for languages. You've also got constantly evolving best practice."

Despite growing interest in emerging languages, the dominance of Java and C# is unlikely to be shaken soon. One reason is that many of the alternatives compile to a format that executes on the Java or .NET runtimes, such as Groovy and JRuby, which are dynamic languages for Java, and IronRuby, IronPython and F#, which run on .NET. This enables easy integration and access to rich runtime libraries.

Andrew Barilla, a software engineer at Verizon, loves F# and Python but expects the old stalwarts to remain dominant. "Dynamic languages are like third parties in the American political system. They exist less to win than to affect the issues brought up by the mainstream," he says. It remains true that programming languages today are more diverse and engaging than at any time since the early days of computing. --

GUARDIAN

No comments:

Post a Comment