yozzeff thinks

musings about programming

Samstag, Mai 20, 2006

Me afraid of javascript?

kevin wonders why people try to avert writing javascript.
especially when they use some sort of transformation/compiler
from another dynamic language to javascript.


he names a few problems when working with js
  • you are not shielded from the differences of
    the browsers (this is only possible thru the library you use)

  • debugging javascript in the browser is a major PITA.

  • if your transformation tool is buggy you are
    back to square 1 and you need then to know your
    transformation and javascript on top

but are these the real problems of javascript development?
actually i dont think so!


what javascript is really missing are modularization features
enabling you to do large scale development.
namely javascript as of today is missing
  • namespaces

  • type definitions
namespaces allow for modularization in the large whereas typedefinitions (aka classes) allow for modularization in the small.

of course you can easily emulate those features with js.
but what is missing is the mental framework for doing this.

syntax follows semantics

the sameness of every construct you are touching
when working with prototype based languages makes
it quite hard to distinguish between small and large modules;
between important and not so important sourcecode elements

one reason i think that prototyped based languages never
quite took off is that they are sort of restricting
despite their dynamicism (actually i only know javascript
and self). keywords can have a quite liberating effect
even thou they do restrict you.

new keywords?

please dont take this a plea for new keyswords in
javascript. rather it is a plea to give me the tools to be
able to create new keywords in javascript if i feel so.
that is give me syntactic macros.

at the moment i use javascript libraries only in small
doses when doing a bit of rails development. if i had
to develop a large webbased application i'd rather
use actionscript 3.0.
i have ported a quite large application just a few
weeks ago from qooxdoo to actionscript in about
1/5 of the time it took me with qooxdoo.
the reason was not so much qooxdoo
(a very cool ajax-gui-framework) but having so much
javascript files without any support for modules
made the whole thing a real pain.
flexbuilder of course helped as well :-).