XML pioneer pitches functional programming for concurrency

Tim Bray, co-inventor of XML and now with Google, hails languages such as Erlang, Clojure as developers deal with multicore chips

Rather than using threads, functional programming presents the superior approach for developers who must program for newfangled multicore processors, XML co-inventor Tim Bray stressed at a technical conference on Friday.

Programming for multicore chips requires that developers deal with concurrency, which brings its own issues, Bray said in a presentation at the O'Reilly Open Source Convention (OSCON 2010) conference in Portland, Ore. Multicore processors have become popular as Moore's Law pertaining to increased single-core processor performance has run out of steam, Bray noted.

[ Also at OSCON, Mirah was touted as a language that offers Ruby syntax for Java development. See the InfoWorld report. ]

"Concurrency is hard. It involves a lot of problems that are very difficult to think about and reason about and understand," said Bray, who is developer advocate at Google. Bugs and performance bottlenecks are among the issues with concurrency, he said.

But functional programming, leveraged in languages such as Erlang and Clojure, offers a way to tackle concurrency, Bray stressed.

"The idea of functional programming is that data is immutable. You can't share data," Bray said. If data cannot be shared, then developers do not have to worry about more than one person changing it at once, he said. Immutable data allows for use of pointers instead of sending the real data, Bray noted.

Erlang is "bulletproof, and reasonably high-performance," Bray said. Originally designed for programming massive telephone switches with hundreds or thousands of processors, Erlang has no classes, objects, or variables, and its file handling is miserable, but there is still a lot to love about it, Bray added.

Clojure, Bray asserted, is a Lisp, runs on the Java Virtual Machine, and compiles to straight Java bytecode, which makes it extremely fast.

"This is super, super-high-performance language," Bray said.

Historically, it has been thought that the way to program for concurrency is through threading, Bray said. But programming with threads, which offer multiple access to shared, mutable data, is "something that is not understood by application programmers, cannot be understood by application programmers, will never be understood by application programmers," added Bray.

Bray stressed his presentation pertained to work he had done prior to his employment at Google, where he now works on the Android mobile platform. He joined Google earlier this year. Bray previously worked at Sun Microsystems, where he was director of Web technologies. Sun was acquired by Oracle early this year.

This article, "XML pioneer pitches functional programming for concurrency," was originally published at InfoWorld.com. Follow the latest developments in business technology news and get a digest of the key stories each day in the InfoWorld Daily newsletter and on your mobile device at infoworldmobile.com.

From CIO: 8 Free Online Courses to Grow Your Tech Skills