Live data from Hacker News

Announcing Backbone.js: Models, Collections and Views in 2.4kb

documentcloud.github.com

41–50 of 62 posts

Re: Announcing Backbone.js: Models, Collections and Views in 2.4kb

#42
post #5

This looks very nice. I already use underscore an jquery for all of my projects. I'll try this on my current project and report my findings.

Looking for underscore and found this interesting testing page: http://documentcloud.github.com/underscore/test/test.html

Re: Announcing Backbone.js: Models, Collections and Views in 2.4kb

#43

Wow I am incredibly impressed by this, great work to the DocumentCloud team! I can't wait to throw this into real-life use... it looks like everything I could ever want in a framework. I too am a jQuery developer, but not your typical one. I tend to avoid slapping plugins together and write most of my own things from scratch, in my own pythonic classical style. I also tend to use the little jQuery helper methods and…

I'm a JavaScript newbie. I'm just curious as to how your code (as shown in dpaste.de/pKOi) is better than Douglas Crrockford's module pattern? Please enlighten me,thanks for help.

Basically he’s just using JavaScript’s built-in objects and making the initializer function call the prototype's init. The advantage vs. Crockford’s "module pattern" is that if you plan to make many instances, the functions don’t all need to be recompiled every time, or take up extra memory.

I would advise the GP poster to pick up some class implementation (or roll his own), and use some bind function instead of all the `self`s (if only because other JavaScript programmers will recognize the style better). One that seems to work reasonably well for simple use cases is John Resig’s suggestion, http://ejohn.org/blog/simple-javascript-inheritance/ though one thing to keep in mind with that implementation (just as with the poster's) is that new instances must be created with `new`.

That one is supposedly inspired by base2: http://code.google.com/p/base2/source/browse/trunk/lib/src/b...

However you decide to do it, the prerelease versions of Resig’s upcoming book are quite helpful in understanding how these designs work and all the tricky corners of JavaScript closures and object inheritance.

Re: Announcing Backbone.js: Models, Collections and Views in 2.4kb

#47
post #19

This looks great. I'm primarily a Flex developer and JavaScript for web apps has always scared the bejesus out of me as I felt I was back to the dark days of ActionScript 2. I still feel I'm faster with strong typing and a good IDE (I hardly type anymore it's all code completion) but micro frameworks like this are a huge step in the right direction. Is there an IDE for serious JavaScript development? Right now for JS…

Try using haXe for your JS code. The syntax is extremely close to AS3 and you'll get the static types and classes back, as well as lots of other nifty stuff.

IDE support is still kind of lightweight, but there are several options out there: http://haxe.org/com/ide

I use Geany, because I only really need context-sensitivity, highlighting, and search+replace.

Post reply on HN