My thoughts on Javascript

by Mike Gleicher on September 3, 2012

The best parts of Javascript are the practical ones:

  • runs everywhere
  • easy to deploy
  • no worry about getting the right libraries
  • good performance (thanks to really clever compilers)
  • lots of tools and helpers
  • easy to glue stuff together
  • great for handling media
  • easy to make stuff look good – use web infrastructure
  • don’t need to worry about overall program structure
  • debuggers and other tools

The basic ideas of the language are good

  • Modern
  • First class functions, lexical scope, closures
  • prototype / delegation (rather than class/instance)
  • memory managed
  • Dictionary / Hash based data structures
    • the dictionaries are queriable – allows for introspection
  • Enables different ways of thinking (selector based like query)
  • literals allow data in code (or code in data)
  • Prototype/delegation-based (give flexibility)

Provides Mechanisms – programmers choose to use to make idioms

  • fake classes
  • chaining
  • ducktyping

Lots of the details are wrong (in my opinion) – contrast with Python

  • Lexically scoped – but only some times
  • The confusion about this (invocation idioms)
  • undefined is a valid value – generally,
  • missing dictionary entries return undefined (not errors)
  • too easy to do things globally (forget a var)
  • too easy to re-write syntax
  • too many things have too many ways to do them
  • prototype is magic
  • constructor functions are magic
  • arguments array is not an array

Some things are just missing

  • default parameters, keyword args
  • decent support for lists
  • nice iterators
  • fast, fixed type arrays
  • optional type checking
Print Friendly, PDF & Email

Previous post:

Next post: