Throw up#
Sun, 21 Jan 2007 18:55:52 +0000
I started writing something about javascript, but it rapidly became mind-blowingly tedious even to write, so I can see no reason that reading it would have been any more fun. Herewith the executive summary.
The task: rewrite the LFNS route editor/viewer so that I can actually understand what it's doing (and perhaps more importantly, what it should be doing but is failing to do)
Lessons learnt:
- Don't try to use inheritance to link loosely-coupled system (e.g. the Model and View in an MVC architecture), because the effect of javascript inheritance is to couple them tightly. A publish/subscribe event-based system (I'm using GEvent, just because it comes for free with the Maps API) is a much nicer fit for the language. Yes you can do inheritance. But trying to call the "superclass"(sic) method from your overridden method is enough work that you should get the hint the language wasn't really intended with that in mind. And you can forget CLOS-style interesting method combinations
- Don't write
for (var a in myarray)
. Not if you want to use prototype.js anyway - prototype.js is the stupidest name ever for a javascript library, because, guess what, the word "prototype" is already heavily used in javascript. Congratulations, anyone trying to google for assistance is basically screwed.
- while I'm thinking about Google: there are too many morons writing web pages about javascript, too many others linking to them, and my js googlefu is not yet sharp enough to devise search terms that won't pull up their retarded witterings.
All my wheels, in one basket