Continuous Tax

Published: 9:09 PM GMT+12, Thursday, 27 September 2007 under: technology
javascript  dynamic  prototype 

Cedric Beust seems to have caused a bit of stir amongst the community with his recent post on the Continuous Tax which comes along courtesy of dynamic languages:

This "continuous tax" is defined by the fact that when you need to maintain or use an API that was written in a language such as Ruby or Python, you have very little information available to you, and even if you eventually figure it out by looking at the sources of the tests (does anyone ever do that?), this knowledge you gain is ephemereal, and you will have to go through that same exercise if you need to modify this same portion of code a year later.

I'm not jumping on this specific argument as I can see both pros and cons to both dynamic and static languages, however shortly after reading these posts I was visited by the tax man when deploying $APP to production.

At the time the problem was reported as "javascript errors are being thrown all over the place" - one was a known problem when running under an older version of Resin, the other however - ONLY occurred in Firefox on MY MacBook - Camino and Safari worked fine, Internet Explorer and Firefox on the Windows laptop worked fine - and finally - Firefox on my Linux machine didn't work.

After the unwanted rollback I spent the day chasing down the elusive bug...

fn.create is not a function
http://hostname:8080/scripts/mootools.v1.11.js
Line 610

The problem was a missing method inside the mootools library. As part of mootool's initialization the Function object is extended with several new methods - create() being one of them. The script is loaded before any of our own javascript files so it should be safe to assume that these additional methods are added to the Function object. Unfortunately for me, for some reason something was slowing down my browser and causing the mootools.js file to run after our own javascript, so various event handler instances didn't have the create() method (I eventually traced the problem to being the CoComment Firefox extension - I'm not entirely sure WHAT it was doing - but it wasn't doing anything good).

In this instance - the "continuous tax" against the dynamic nature of the language - being able to add methods to an object instance might offer excellent flexibility to the language and its frameworks, but it can also bite you where it hurts when things don't run quite as you expect.

Technorati Tags: ,

Comments (0)

Add Comment