Javascript curmudgeoning

by havoc

I’ve been known to complain about
Javascript
before. The thing that’s bugging me this week:
attempts to claim its misfeatures are a positive.

First we have this
tutorial on splice()
:

Using the example, try entering bad data in the
boxes. Try entering letters (numbers are needed). Try entering numbers
too large or small for the array. You’ll notice that nothing
happens. The program does not crash even though I’ve coded no error
control.
One of the best features of using array methods to update dynamic
arrays is that errors are automatically handled with a default action
of nothing.

Wooohooo! My program silently does nothing when it has a huge bug in
it!

OK, that may be debatable. But how about
this
defense of the Javascript class/inheritance “system”
:

JavaScript can be used like a classical language, but it also has a
level of expressiveness which is quite unique. We have looked at
Classical Inheritance, Swiss Inheritance, Parasitic Inheritance, Class
Augmentation, and Object Augmentation. This large set of code reuse
patterns comes from a language which is considered smaller and simpler
than Java.

Gee, I live to choose among 5 kinds of inheritance, all of them
inconvenient and bizarre.

Unlike sane dynamic languages such as Python, Javascript isn’t even
typesafe at runtime… if you pass the wrong number of args that’s
cool, if you pass the wrong kind of object that’s cool too, assign to
a nonexistent field – let’s just create that!, use a string instead
of an integer – let’s just convert it! – do inheritance wrong – oh,
you’re inventing a cool new kind of inheritance! Sweet!

The hype about Ajax has to be amazement that anyone got this
crappy language to do anything at all.
Google has the right
idea
:

Google Web Toolkit (GWT) is a Java software development framework that
makes writing AJAX applications like Google Maps and Gmail easy for
developers who don’t speak browser quirks as a second
language. Writing dynamic web applications today is a tedious and
error-prone process; you spend 90% of your time working around subtle
incompatibilities between web browsers and platforms, and JavaScript’s
lack of modularity makes sharing, testing, and reusing AJAX components
difficult and fragile.

That about sums it up…

If you think I’m overreacting you probably haven’t written and
maintained enough Javascript 😉 and we would be
very happy to hire
you
so you can get more practice. You think I’m kidding, but I’m not…

(This post was originally found at http://log.ometer.com/2006-08.html#10)

My Twitter account is @havocp.
Interested in becoming a better software developer? Sign up for my email list and I'll let you know when I write something new.