Sunday, October 26, 2008

Extending Object's prototype or making Joose more robust

While working on Joose's unit testing system we created a new test mode that disturbes the environment by doing evil and not so evil things that Joose might encounter in real world situations and then run the test suite.
We discovered that we get some failing tests when Object.prototype gets extended. This is a known bad practice but you'll still find it in the wild. This is now fixed in the latest SVN version of Joose.
We currently test the following scenarios:
  • extending Object.prototype
  • extending Array.prototype
  • extending Function.prototype
  • running with jQuery loaded
  • running with Prototype.js loaded
  • running with Mootools loaded
  • running with Dojo loaded
  • running with YUI loaded
If you have ideas for more things that might be a problem for Joose, please speak up! (Doing thinks like Function.prototype.apply = function () {} is not a valid entry :)

Currently Joose is not compatible with Prototype.js and Mootools. This could be fixed. If anybody really cares about these JS libraries, please scream and we'll fix it. (Of course, patches very welcome. Fix strategy described here)

Update: Joose now runs with Prototype and Mootools. Get the latest SVN if you want to play with it.


Anonymous said...

Could you explain why joose is not working with prototype.js? Is there anything we (prototype.js) could help with?

Unknown said...

Joose and Prototype use some of the same global (window scope) variable names. (I think Prototype, Class and maybe even more).

I'm afraid this is something we'll have to fix, by not depending on these globals anywhere in our framework code.

Unknown said...

I fixed it :) There is one failing obscure bug related to jsonpickle serialization but nothing serious. Now you have to promise to play (and blog about) Joose :)

Beware when running under Prototype you will have to prepend Joose before all global Joose functions:

JooseClass("MyClass", {