Ruby, Clojure, and Ceylon: same goal, three very different results

Charles Nutter, Rich Hickey, and Galvin King each discovered that 'simplicity' doesn't mean the same thing

By Andrew Oliver, InfoWorld |  IT Management, Ceylon, Clojure

Ceylon, Nutter says, aims to be "an evolutionary 'better Java' that doesn't try to take a revolutionary leap forward (Scala) or completely change paradigms (Ruby)." Its creator, King, seems to agree; he considers "Ceylon to be an alternative to Java that interoperates well with Java." Ceylon focuses more on tooling and is itself developed using the Ceylon IDE. Due to their dynamic nature, "you'll never ever find a tool like Ceylon IDE for a language like Ruby, Python, or Smalltalk," he says.

Clojure's simplicity at first may appear more complexClojure is the most unique of the three. The syntax for Lisp was heavily influenced by lambda calculus (PDF). Like Ruby, Clojure is dynamically typed, but where Ruby is a more nominally imperative object-oriented programming language, Clojure is functional. Hickey's idea of simplicity doesn't exactly match up with King's and Nutter's. Clojure aims to remove "self-inflicted complexity derived from their programming languages, approaches, and tools," Hickey says.

Clojure's simplicity is fundamentally different from that in Ceylon or Ruby. The best way to understand Clojure's simplicity is by an example. Stuart Halloway, who runs a consulting company down the street from me, recently gave a talk to the New York City Clojure User's Group and provided a code sample of Clojure reflecting on the java.lang.String class and printing out members named "last":

He said that code could be "simplified" in Clojure to:

Initially, the latter appears more complicated. To the uninitiated, it is at least harder to read. However, it introduces the least number of new concepts to the language. In the words of Clojure's Hickey, "Simplicity means lack of entanglement. For a programming language, it means delivering abstractions and mechanisms that each do one thing well, and can be composed as needed." The first example cannot be composed at all.

King explains that "we read code a lot more often than we write it, so readability is the most important criteria for judging the syntax of a language. A programming language is for communicating algorithms to humans." If you're familiar with Java, Pascal, C#, or any of the other widely used higher-level languages, the syntax of Ceylon or Ruby will probably be more readable to you. If you come from a more mathematical background, I believe Clojure will be an easier fit. Indeed, when writing software that is heavily algorithmic in nature, Clojure's syntax looks brief and relatively clear.

Originally published on InfoWorld |  Click here to read the original story.
Join us:






IT ManagementWhite Papers & Webcasts

Webcast On Demand

Data Breaches - Don't Be a Headline

Sponsor: Absolute Software Corporation

White Paper

PCI 3.0 Compliance

See more White Papers | Webcasts

Answers - Powered by ITworld

ITworld Answers helps you solve problems and share expertise. Ask a question or take a crack at answering the new questions below.

Ask a Question