Will Ceylon kill Java?

219

ceylon-01

Somewhere out there is a list of all programming languages on the planet.

We don’t have it. We don’t even have the patience to create it. Why? Because there are thousands and thousands of languages out there, and the sheer task of documenting them could take a lifetime.

But among all of these, a very particular language deserves our attention. Why? One, because it may eventually end up being a feasible alternative to both Java AND Javascript (two of the most widely used languages in the world), and two, because it’s called Ceylon.

That’s right.

Ceylon was something we stumbled onto back in 2012. Word had hid the ‘net of a new programming language, headed by Gavin King and a strong core of profilic Red Hat developers. At the time, it was an interesting project to watch: but as of November 12th, 2013, Ceylon is not only out for public consumption, but is already garnering a growing developer community. Let’s have a closer look.

 

What IS Ceylon?

Ceylon is a language for team projects. At its heart, it’s driven by the philosophy that code should be easily readable, understood, follow simple rules and overall make it possible to read, understand and modify the other guy’s code without tearing out your hair in frustration.

Also read Ceylon: a new programming language

But Ceylon’s killer feature is that it runs on the JVM. For those not in the know, Java is one of the world’s most widely used programming languages. Programs written in Java are designed to be run across different operating systems and platforms, and to that end Java has something called the JVM: the Java Virtual Machine. It takes your Java program and spits it out as code which runs on whatever machine you need it to run on.

The JVM is what actually does all the work. You command it in the language it understands (Java) and the faithful beast does the work. 

Ceylon works just as well.

In fact, Ceylon not only works as a Java replacement, but it also does the same for Javascript. Node.js, web pages: Ceylon handles them all. This new programming language is a redesigned usurper that seeks to be a friendlier, more usable alternative to Java.

That’s not a bad thing. In fact, this is huge news for anyone who’s fed up of Java’s quirks and gimmicks. Ceylon isn’t a Java-killer by design: instead, it’s meant to make quite a few things a lot easier to do. 

 

What’s on the table?

Nobody’s touting Ceylon as a Java-killer, not even its enthusiastic developers. But Java’s got some footling problems under its hood. The Ceylon development team believe that Java hasn’t kept up with the times. To that end, they’re not just introducing a new grammar: they’re introducing a whole new SDK to replace to outdated and bug-riddled mess that is the Java SE SDK. As a result, Ceylon does some things that would take a Java program several twists, turns and backflips to achieve. 

 

Let’s shift into a bit of geek here.

Like modularity. Ceylon brings jar-level control to the field, and for once you don’t have to mess around with Maven and OSGI. Three dozen lines of Java code become 7 lines of Ceylon code. It’s already miles ahead of Java Jigsaw.

Since Ceylon also compiles to JavaScript, and JavaScript doesn’t understand Java’s horrendously tedious process of method overloading, Ceylon’s gotten rid of that and replaced it with defaulted parameters and union types. You can essentially create variables that can be any of two types – or both – it’s as simple as typing String|Integer. That’s overloading right there, distilled to a T.

Even better: intersection types. Java’s generics support this, but Ceylon plans to take it several steps further. The next few versions will see intersection and union types that can interact. Think back to math lessons on sets, where we would carry out all sorts of complex union and intersection operations on sets. You can pull it off with variables. And when the type is getting way too long and complex, you can assign it a simpler name – type aliases, a C++ feature that should have been in Java a long time ago.

Again, Ceylon’s objective – making code more readable to other people – can be clearly seen in these few features alone. Type alises, for instance: the only way you can pull off something similar is creating a wrapper class (HashMap, anyone) and pull off some fancy fingerwork with it. Give that code to the next guy down the line and he’ll waste previous time trying to understand what the heck you’re doing there.

 

So will it kill Java?

No. We’re not saying this will replace Java. The industry’s seen Java killers before, and Java is still defiantly alive. A language’s success depends on more than how good it is – Google’s “Go” language is an excellent example. However, Ceylon’s got such a good thing going on that Java could take lessons. It won’t be long before Ceylon is a very serious choice for enterprise development – now might just be a good time to download it, poke around and see if there’s anything worth holding onto. 

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here