1

quick question (with slightly laborious build up)....

Both Douglas Crockford and Stoyan Stefanov in their JavaScript books strongly encourage staying clear of Classical (class based) paradigms when implementing JavaScript projects, and exploiting its prototypical design.

I find this appealing as it seems for what you loose in type safety and optimization, you ought to be able to gain by flexibility and maintainability (which as I understand it was the goal in creating Self, the first prototypical language)

I need to create an object pooling system, to control the garbage collector as I'm trying to create as near as possible 'real-time' simulations for web based learning material.

The only implementation that is open (as in well documented and commented) that I can find is part of gamecore.js library, and this tutorial.

This implementation works with class.js - a library that enables classical emulating pattern, and to use it in my project would require me to use the classical emulating inheritance.

So, after all that, my question is simply - Does anyone know of a publicly available object-pooling script that does not have class emulation as part of its implementation?

(it's just to save time, there's only 2 weeks to build this thing....)

Thank you in advance

James

Goldsmiths University

James Cat
  • 432
  • 2
  • 12
  • At least according to his website the last time I checked it, crockford uses closures (behavior that owns data, instead of data that has behavior) instead of the javascript object model. "Classical" is much closer to prototypal than closures. For example, you cannot have "private members" (as crockford puts it, even though it's dangerously misleading), when using prototypal js. – Esailija Aug 13 '12 at 12:16
  • I was reading this: it seems the motivation behind prototypes is to come up with something more mutable (possibly at runtime) than classes. I am at the point of giving up on this though, the library that creates objects of type class that give you classical features seems like a good idea, it's still dynamic, and I don't think it will lead to a static inflexible heirarchy, although if it does I will post here :-) – James Cat Aug 13 '12 at 20:10
  • Classes can be dynamic, for instance ruby classes are just as dynamic as js prototype, if not more. – Esailija Aug 13 '12 at 20:12

0 Answers0