2012-12-21

Language complexity: C++, Ruby, CoffeeScript and JavaScript

Alex Corban has written an article on C++ Rocks that diagrams the complexity of three programming languages: C++, Ruby and CoffeeScript. Here is the bird’s eye view:

One way of paraphrasing “the complexity of a programming language” is “how difficult is it to learn the language until you are productive”. Obviously, measuring complexity in the above manner is interesting, but not the whole picture: Some concepts are more powerful than others. And sometimes adding a new concept decreases the complexity of a language, without making other concepts completely obsolete. As an example, look at ECMAScript 6 classes [1]. They will simplify inheritance, but you still need basic knowledge of constructors. Furthermore, much complexity is contained in software stacks (runtime library, 3rd party libraries, etc.).

The complexities of JavaScript and CoffeeScript are not too far apart. After all, the latter is based on the former. That made me think: JavaScript plus quirks is less to learn than many other languages that have fewer quirks. Additionally, when learning JavaScript, you can start small and software stacks are usually comparatively lightweight.

Reference:

  1. ECMAScript.next: classes

3 comments:

Michael Smith said...

"JavaScript plus quirks is less to learn than many other languages that have fewer quirks." Hmm, well, yes, but I wonder if it's precisely that ease-of-learning that lets you get away with not understanding the quirks or knowing they exist at all. It's a double-edged sword.

Axel Rauschmayer said...

The problem may indeed be that JavaScript minus quirks *seems* easy to learn. You need a good book that includes the quirks with the features.

Learning good style seems harder in flexible languages (JavaScript, Python, Ruby, Common Lisp, etc.) than in more rigid ones (Java).

pixelBender67 said...

totally agree, JavaScript is tricky that way ,you can emulate different styles ( classical inheritance, prototypical inheritance functional programing), deep down, JS is really expressive and powerful

Web Analytics