Blog about (Web-) Programming, Graphics and Games.

01.08.2010

What I like about Javascript (compared to Java)

This list was assembled, while I was coding some Javascript projects (see blogposts below), and is of course only a subjective view:
  • dynamic typing: simpler declarations, no casts, no interfaces, less keywords, simpler syntax (but I see possible drawbacks: its may be more error prone, and probably less runtime performant)
  • "this" is mandatory to access object-variables, in java its optional. This is more clear semantics and promotes the use of local variables.
  • simple and powerfull Array and Hashtable (instead of Java's multitude of Array,Vector,List,Collections..)
  • prototype based object system. its more flexible than javas class based system, e.g. you can add methods to existing objects.
  • last but not least: it runs everywhere in the browser, quite like java, but in a more straightforward and powerfull way (direct dom access, not like a plugin).
Still, Java keeps being great, but above points make Javascript very much interesting, imho.

Keine Kommentare: