Clojure, Ruby, Scala, and Go: When to Use Which?
Just came back from a SDForum meeting organized by its emerging technology SIG. The topic was about the 4 languages in the title. It’s not much about any emerging technology per se, but pretty controversial among the developers.
The organizers invited four panelists and one moderator:
Time to learn how to "Google" and manage your VMware and clouds in a fast and secureHTML5 App
- Clojure advocate – Amit Rathore, author of the forthcoming “Clojure In Action”
- Go advocate – Robert Griesemer, Google, co-author of Go
- Scala advocate – David Pollak, lead author of Lift
- Ruby advocate – Evan Phoenix, lead developer of Rubinius, a high performance Ruby VM
- Moderator – Steve Mezak, co-chair of the SDForum Software Architecture and Modeling SIG, author of Software without Borders
Each of the panelists had 10 minutes of introduction of the language in the first part. Then, they all answered questions ranging from language strength/weakness, library/tool/IDE support, application framework, advice on migrating existing codebase, to how these languages compare to each other.
Here are introductions from the languages’ homepages. See if you can map them to the languages.
* is a dialect of Lisp, and shares with Lisp the code-as-data philosophy and a powerful macro system. * is predominantly a functional programming language, and features a rich set of immutable, persistent data structures. When mutable state is needed, * offers a software transactional memory system and reactive Agent system that ensure clean, correct, multithreaded designs.
a systems programming language – expressive, concurrent, garbage-collected.
A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.
* is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages, enabling Java and other programmers to be more productive. Code sizes are typically reduced by a factor of two to three when compared to an equivalent Java application.
In some sense, programming languages are like religions. Different developers may have quite different languages they like or hate. For me, I don’t care too much about what programming language to use as long as it can do the best job – least time with the most done. The “time” has to include the time that I use to learn that language, and APIs/frameworks if any.
Too many times you may see a demo showing you one line in one language can do more than 10+ in other languages. You say, “Wow!” When getting into it, you find too many things to learn, and it’s not so easy to customize to your projects.
So what should you chek while deciding which language to use for your next project?
- Is the language supported on the platform I will work on?
- Is the lauguage good for the nature of my project? For large scale system, a strong typed language is highly desirable. For multi-thread system, concurrency control is a must.
- How hard is the lanugage to learn? Is it close to any language I am already familiar with?
- How is the library support? Is it complete enough for my project?
- Do I need any framework? How deep is the learning curve?
- How active is the development community behind the languages/APIs/frameworks?
- Any similar systems that have been implemented in the language?
When in team development, the decision is more than a personal preference but the group. Sometime it can go all way up to company policy. Many company actually doesn’t have a strong mandate on what languages to use. In some products, you can find find different languages and frameworks are used.
Modern software espeically applications are mostly built on top of some kind of abstractioin layer like JVM/CLR, and heavily use API/frameworks. It’s increasingly important to have good support beyond the language itself. Luckily, most popular frameworks are ported to different languages.