02 October 2012

Designer Languages

Handwritten by TVD

Designer Language: a programming language created to avoid the perceived shortcomings of an existing language, usually by creating a superset of the existing language by modifying syntax or modifying programming constructs.

The designer language usually compiles to its parent language and its compiler is usually written in the new langauge itself. The latter of which apparently adds a wow factor to the whole affair.

But all this is nothing new. The Java language has survived its share of designer languages over the past decade or so.

Designer Languages: The Java Frontier

Groovy

James Strachan introduced the Java world to Groovy in early 2007. Dynamic and loosely typed, Groovy built upon the strengths of Java but had additional power features inspired by languages like Python, Ruby and Smalltalk.

With the invention of web frameworks like Grails, Groovy continues to influence the J2EE landscape to this day. However, it wouldn’t be long before the J2EE landscape would again be rocked.

Scala

Similar to Groovy, but with an increased focus on Functional Programming, Scala is another interesting designer language built on top of Java.

In early 2009, a burgeoning social media company (Twitter) picked up on a little known language called Scala. Famously, a Ruby on Rails shop, Twitter kept Rails for its presentation layer and swapped out its backend with Scala.

Twitter’s move to Scala sent ripples through the Rails community and ushered in another star to the limelight. But this is the nature of designer languages - to ripple, to rumble, to roll.

Designer languages are the forest fires of the computer science world. And it wouldn’t be long before sparks flew towards the JavaScript world.

Designer Languages: The JavaScript Frontier

CoffeeScript

Jeremy Ashkenas, quietly committed CoffeeScript to the JavaScript world in late 2009. A year later, a stable CoffeeScript 1.0 was released.

In a short two years, CoffeeScript managed to influence legions of developers. Simplicity and clean output was the key:

classAnimalconstructor:(@name)->

move:(meters)->alert@name+" moved #{meters}m."

classSnakeextendsAnimalmove:->alert"Slithering..."super5

classHorseextendsAnimalmove:->alert"Galloping..."super45

sam=newSnake"Sammy the Python"tom=newHorse"Tommy the Palomino"

sam.move()tom.move()

Eventually, CoffeeScript made its way to Brendan Eich - The Creator of JavaScript - and it’s influence on the future of the language began.

Inspired by Ruby, Python and Haskell, CoffeeScript went on to become the default JavaScript language in the popular Ruby on Rails web framework.

With those results, CoffeeScript is (arguably), the most successful designer language ever released. I have seen the future of JavaScript and it is amazing.

Much of that future is due to the popular success of CoffeeScript. With CoffeeScript we learned what JavaScript could be.

That’s the greatest lesson to be learned from designer languages. That the future isn’t written in stone. That we too can influence its path and shape its fringes.

CoffeeScript went on to influence and spur further designer languages in both the static and dynamic space.

Dart

Google introduced the Dart language as a final solution to JavaScript in late 2011. The predecessor to Google Web Toolkit (GWT), Dart introduced static typing to the JavaScript landscape.

Developers wrote code in Dart and then compiled to JavaScript - a whole lot of JavaScript to be exact. This was in sharp contrast to the compiled output of CoffeeScript which was readable and didn’t shock the conscience.

Developers weren’t too happy with that type of result and the push back was strong. Rightfully so…

With a web server or desktop app, who cares what the compiler outputs - regardless, your app will run. But, in the browser, every byte counts. So if the browser has to download tons of needless code, your user loses and you lose too.

Most would have thought it the end of big brand collision with JavaScript. But, like life itself, the unexpected happened and Microsoft entered the designer language scene.

TypeScript

Microsoft introduced a superset of JavaScript called TypeScript in late 2012. Some called TypeScript an improved Dart. Yet, others saw TypeScript as a more verbose CoffeeScript.

Based on TypeScript’s syntax, it’s not too hard to see why:

classAnimal{constructor(publicname){}move(meters){alert(this.name+" moved "+meters+"m.");}}