NodeJS and Mootools-Server

33 views
Skip to first unread message

DracoBlue

unread,
Dec 13, 2009, 5:57:55 PM12/13/09
to nodejs
Hello,

since I am pretty used to Mootools-Class implementation, I was curious
if I could get it to work with nodejs.

When checking out Campy [1], I noticed that mootools-server had been
working with nodejs a while back.

Now when I try to require the mootools-server (even the one which was
used in campy):
process.mixin(GLOBAL, require("./mootools-1.2.3-core-server"));

I get the following error:
newClass.implement(params);
^
TypeError: Object function (){
Object.reset(this);
if (newClass._prototyping) return this;
this._current = $empty;
var value = (this.initialize) ? this.initialize.apply(this,
arguments) : this;
delete this._current; delete this.caller;
return value;
} has no method 'implement'

Did anyone run into same issues or has a clue which mootools-internal
doesn't play well here? ;)

As I like to easily extend my objects, I am wondering if I could drop
the idea to force mootools into nodejs and instead use directly the
process.mixin-function for such tasks. Is that a good idea?

Kind regards,
DracoBlue

[1] http://github.com/Bluebie/Campy

Bluebie

unread,
Dec 14, 2009, 5:33:57 AM12/14/09
to nodejs
… Someone cares about campy? Cool! But really, mootool's class system
sucks. Every time you new Something(), it goes and manually makes a
deep copy of EVERYTHING for that object, meaning creating objects
built with new Class({}) is always going to be slow, tedious, and
stupid, performance-wise.

On the browser platform, JS is now insanely fast, and the DOM is the
insanely slow bit, so it doesn't really matter if the code is a bit
inefficient, but on a server this stuff matters, and in MVC frameworks
people often create new instances of objects like templating engine
views, database interfaces, and so on, for every request. After
learning more about javascript, I've come to strongly believe that
mootools-server is a bad idea, and when I come to build my next node
app, I'll likely end up creating a new framework for my needs if
nothing to my taste exists, based around Object.create, using object
inheritance for lovely lovely speed.

I highly recommend if you still feel any attachment at all to the
mootools psuedoclass system, you read lots about the javascript object
inheritance design. I really think you'll be glad you did. This
language is a wonderful language. It is not a simple language needing
a layer of organisational OOP on top of it. It is just a different,
simpler way to do OOP, and with an open mind, I've found I in fact,
vastly prefer the javascript prototype way of doing things. There is
so much power in that simplicity. Power that most mootools users AND
core developers don't use or have access to. Read about Object.create
especially, an upcoming ES5 feature which can be easily duplicated in
native JS for the time being. It's good stuff! Promise!

weepy

unread,
Dec 14, 2009, 5:41:25 AM12/14/09
to nodejs
I'd heartily agree that you should look at Javascripts prototypical
inheritence that's built in. It's very powerful and flexible - no real
need for any OOP layed ontop of it.

Scott Kyle

unread,
Dec 26, 2009, 4:48:35 PM12/26/09
to nodejs
For the record, MooTools has used proper prototypical inheritance in
its Class for awhile.
Reply all
Reply to author
Forward
0 new messages