Language Shootout – SDForum

Steve Mezak – what language for web app?

Closure – Amith Rathore – Runa, Thoughtworks, IBM

Writing ‘clojure in action’ Manning book.

“Is a Lisp” on JVM. Has [] too. Has higher-order functions (map, reduce, filter – accept other functions). Data structures are immutable like in Erlang – that eliminates a whole range of defects. Lazy sequences are like Python generator functions, allows to easily process lists.

Writing multi-threaded code is made easier by distinguishing between identity and state. You change objects by mutating their state in-place. in clojure state is copied – old state stays around, new users can get new data. Change has to managed specially and inside of transactions. STM system. Has all the common data structures. Other buzzwords: agents, atoms, vars.

JVM gives access to a lot of existing (Java) libraries with an easy to use calling method. () = list; [] = vector. Code is data. Macro feature allows you to change the language by inserting code in the middle of the compilation process. It becomes a programmable programming language.

Runa models low-level attributes and tries to combine them into executable functionality that can be processed with a DSL for the subject experts.

Rapid prototyping through Emacs plugin.

OO? Is supported.

It is very easy to expose functions on web services.

Is fast and has powerful features.

Ruby – Evan Phoenix – Engine Yard

Everything is an object and you call methods on it. Principle of least surprise – if it looks like it should work it does.

Works on Rubinius, a new Ruby runtime. Ruby has multiple representations: JRuby on top of JVM,

Multi-threading is supported, varies between implementations. No language facilities for multi-threading, uses a lock library.

Compared against Smalltalk? Used to be a mix between Smalltalk and Lisp and evolved more towards Perl.

Used as an all-purpose language, not just for web apps. Rails functions as an entry-drug.

Compared to Python? Only one way, Guido’s way. Ruby is more flexible.

Scala – David Pollak  –

Hybrid functional-OO language. Runs on the JVM. Is compiled. Designed by Odersky. Used by Linkedin, Twitter, Foursquare, Office Depot, ebay, SAP, etc. Why did they switch? Scala gives you all the benefits of Ruby with the benefits of Java.

Has a type system that doesn’t get in your way through type inferencing.

Wrote beginning Scala book. Started goat radio distr programming model, actor model.

Allows writing very concise code.

Concurrent. Parallel collections. Library, but feels like build in. Like Erlang.

You can write type checking code.

Has a great community, and the 2.8 release has IDE support.

Lift: web framework like Rails.

Compared to Groovy? G is slow, bad type system.

 

Go – Robert Griesemer – Google

Conceived by Google, still very experimental. Allows control over memory layout, for systems programming. Could implement an OS with it. Want to replace C++ with it.

A Go program is a collection of packages. You can import other packages. Looks like C without semicolon.

Motivation is frustration with current state-of-the-art build systems. A lot of toneyping in the code today, as well as dependency problems. Some problems are solved by dynamic languages. Shows a C++ error message of 40 lines caused by a simple omission of const keyword.

Focus is on edit-compile cycle.

Concurrency is build in via the ‘go’ statement. Communication through ‘channels’ which connect “go-routines”. Make it easy to communicate. 100k channels build up, used and taken down, in 1s on laptop.

Open source, portable, many platforms.

Next steps: generics, exception handling.

Not ready for prime time – 1/2 year?

No VM? Directly to machine. Language supports garbage collection, doesn’t need a VM. Systems language with nothing underneath.

Does type system allow generic map? Not currently but clearly something they are working on. sort library expects a container that implements three methods. Like pre-generics Java.

 

***

The Goto statement is in Go as well as in PHP. Someone implemented goto in Scala using continuations.

Test-driven development?

Clojure comes with and supports many frameworks for TDD, including everything Java has.

Ruby has TestUnit, RSpec. Ruby community embraces testing.

Scala also has everything that Java has. Also can test Java. Comes with two test frameworks. Scalacheck calculates what possible parameters are for methods and exercises them.

Go has early-stage easy-to-use test frameworks.

How do go-routines interact with IO? They have their own stacks.

IDE support?

Clojure. REPL dev style. Lisp-like dev style.  Grow a function and turn it into a test.

Ruby? Netbeans has Ruby support, Eclipse Rubymine, Textmate has completions,

Scala, REPL like Clojure. In 2.8 reworked the compiler to be incremental, dump more info out.

Go. Go-mode for emacs, Xcode. IDE – godoc extracts documentation into HTML.

Learning curve

Clojure – a couple of days to get going once you’re over the parenthesis.

Ruby – pretty simple.

Scala – similar like Ruby and Python, less complex than Java.

Go – if you’ve done C before you’ll pick it up quickly.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a comment