Wednesday, December 31, 2008

Is Ruby the new "C"? Decoration vs. Terseness

Hopefully the title of this post sounds odd. Asking if Ruby is the new Java would be more expected, but I want to look at a different aspect of language evolution than just how Ruby compares to Java.

Way back when I started playing with computers we had lots of languages to choose from, Pascal, Fortran, Lisp, Prolog (my personal favorite for some tasks). At that time is was standard and expected that an engineer would be fluent in multiple languages.

One of the aspects of C that is striking is how terse the language can be. Complex statements such as z = (++x > y) ? m : n; can be written with what Tufte might call a high data to ink ratio (http://www.infovis-wiki.net/index.php?title=Tufte%2C_Edward). To put this in the modern vernacular: C has low ceremony, most everything you write matters, there is a low degree of extra tokens needed just to keep the compiler happy.

As we moved to a Java based world where many/most engineers seemed to think they only needed to know one language, we found ourselves with a language with a bit more ceremony. To create a new object I need to say:

MyClass myObject = new MyClass();

Thats a lot of tokens just to get a new object.

One of the stated advantages of some of the newer languages such as Ruby is that they are low on ceremony. Sometimes writing fewer token makes the code simpler but sometimes it simply makes it terse.

I wonder if somehow we're coming full circle back to the asthetic of C.

No comments:

Post a Comment