- Standardized inheritance: Java has acceptable inheritance built into the language (although primitives are a nuisance and traits or mixins would be nice). In JS, if you want to do inheritance, getting by with just the language is painful. Thankfully it is easy to extend it and that lead to some very nice inheritance APIs. But there are simply too many of them. And most of them are much too complex. The most minimalist yet elegant solution I have seen so far is John Resig’s Simple Inheritance .
- Standardized modules (packages): Similarly to inheritance, JS can be extended easily, but there is no common standard. CommonJS might find some mid-term traction, though.
- Standardized type information: I am not using the term “type annotations”, in order to avoid confusion with Java’s annotations. Having type information is natural in Java, because it is statically typed. JS is a more dynamic language and does not strictly need it. However, many APIs do include types as comments or in external specs. For example, Mozilla uses Web IDL in specs such as the IndexedDB API. It would be nice to have the standardized option for adding this kind of information so that tools have something to work with. Static analysis, e.g. done via DoctorJS, can infer many types, but I would still like the option to add this information explicitly. As an aside, if an IDE did type inference, then I would love to see the inferred types, e.g., next to the formal parameters of a function.
- Standardized API comments: Java has JavaDoc, JS has several competing standards.
- Standardized unit testing: JUnit is the dominant standard for unit testing in Java, while almost every JS framework comes with its own implementation.
These six points are partly responsible for Java’s excellent tooling. Without them, it is doubtful that JS will ever catch up. So you can read this post as a check list of things that an IDE has to tackle in order to be truly useful (understand inheritance, the structure of the code base, typing, etc.).
universally accepted as a standard for the next JS version. And what one
reads about the version after that, JS Harmony
, is very promising.
Which of the above points present long-term problems?
I expect (1) and (2) to eventually become language features, but it would still be nice if everyone could agree on standards until then. (3) might make it as type guards
into JS Harmony. (4), (5) and (6) can only be tackled via standardization.