Sunday, October 10, 2010
My New Favorite Language
Lately, I’ve been working in Java, Lisp, and JavaScript. It’s been interesting to see the similarities and differences in the three.
First, Java - I don’t like it. I really don’t. It’s syntax is overly verbose. The type and packaging systems are arcane, even for their age. Directly using primitives and object wrappers seems silly and breaks the object-oriented paradigm. The rigid class system forces you into creating complex hierarchies to create programs. One public class per file, really? And, to top it off, it’s controlled by Oracle.
Yes, Java has a huge standard library, which is nice. However, the language isn’t the library.
Which leads me to Lisp. It’s syntax is very expressive, save for the obnoxious plague of parentheses. Using Emacs and elisp together provides an excellent environment for programming; it’s got built in documentation lookup, syntax highlighting, scratch buffer, etc. However, the library support is pretty bad.
The one caught in the middle is JavaScript, with the syntax of Java and the concepts of Lisp. Douglas Crockford points out the power of JavaScript’s anonymous functions, which were inherited from Scheme. This is not a construct that is present in Java, but I’ve found that it’s tremendously beneficial for JavaScript’s event-driven model in the browser. It, linked with the object literals and prototypal inheritance, allow for a lot of flexibility and expressiveness. Honestly, I’m finding that JavaScript is becoming my favorite language. Yes, I’d have to use it no matter what in web development, but I actually catch myself wishing I could be using Node.js at work.
Server side JavaScript is definitely appealing, but there aren’t that many libraries out there. On the one hand, that’s not a problem - there are tons of redundant libraries like jQuery, Prototype, Dojo, and so on. People are happy to write their own libraries in JavaScript, it seems. But, there is the movement for creating common APIs at the CommonJS site. I think this is a good idea, but not everyone’s on board: Node, for example, is selective in what it takes.
It will be an interesting road forward - JavaScript is all over, but with lots of people figuring out that it can do more than simple web page gadgetry, I think it will become a contender to Python and Ruby in server side languages in the next few years.
Subscribe to:
Posts (Atom)