Live data from Hacker News

Spine -- A lightweight framework for building JavaScript web applications

maccman.github.com

21–30 of 50 posts

Re: Spine -- A lightweight framework for building JavaScript web applications

#21
post #17

How funny, I'm working on Vertebrae.js, a JavaScript MVC framework.

Honestly there are so many JS MVC frameworks. I'm looking at using one in the next little while, but with so many it's going to take more effort than I'd like to pick a good one.

Re: Spine -- A lightweight framework for building JavaScript web applications

#22

Earlier quoted context omitted.

This isn't Backbone.js -- it's an alternative. Different codebase, different function names, partially overlapping API. At the top of the FAQ, he answers some of the comparison questions: http://maccman.github.com/spine/#h-faq The bit about it being smaller is pretty misleading (especially when comparing 2k to 3k) -- it may be 500 lines instead of 1100, but the 1100 are heavily commented, and the 500 are entirely com…

I'm curious how you respond to the differences in the Spine inheritance model and the argument they make for it: "Spine's class implementation is one of its features that makes it stand out from the crowd. Rather than copying properties to emulate inheritance, as most libraries, Spine uses JavaScript's native prototypal inheritance. This is how inheritance should be done, and means it's dynamic, properties are resolv…

Backbone uses proper prototypal inheritance ... so I'm not sure which "most libraries" he's comparing to there.

In fact, Spine doesn't use "JavaScript's native prototypal inheritance", which, if we're being honest, is the use of constructor functions with prototype properties. It uses an emulated version of Object.create:

https://github.com/maccman/spine/blob/master/spine.js#L79-11...

... which, even when natively implemented, is quite a bit slower than the real thing:

http://jsperf.com/new-vs-object-create

Re: Spine -- A lightweight framework for building JavaScript web applications

#23
The number of js frameworks popping up is kind of crazy. Clearly tons of overlap between them all. It kind of makes me want to not choose one and wait for tech natural selection to whittle the options down and hopefully along the way the best elements of each are demonstrated and incorporated into the few winners.

Re: Spine -- A lightweight framework for building JavaScript web applications

#24
post #23

The number of js frameworks popping up is kind of crazy. Clearly tons of overlap between them all. It kind of makes me want to not choose one and wait for tech natural selection to whittle the options down and hopefully along the way the best elements of each are demonstrated and incorporated into the few winners.

To a large degree that's what Ender.js is trying to do. Whether it'll succeed or not remains to be seen.

Re: Spine -- A lightweight framework for building JavaScript web applications

#25
post #8

Seems neat, but it would have been nice to differentiate itself from backbone a little more upfront. The sites even look similar. The key architectural difference seems to be that the ui is updated before the server responds, which is great in a single user situation, but can get pretty inconsistant once you're in a multi user app. I do have to say that I like the patterns section at the end, it's always good to see…

That's actually not an architectural difference. In Backbone, when you call .save(), the attributes update instantly, and the changes are synced to the server asynchronously.

That was the main difference pointed out in the documentation. I guess I'd have to try it out to see how it differs in practice.

Re: Spine -- A lightweight framework for building JavaScript web applications

#26
I like the approach of separating the dom events logic into its own controller.

In backbone the dom events are tied to the view which makes it more difficult to reuse the logic with other views. I've worked around this by doing pretty much the same thing as spine; i've created a dom controller from the base controller, but it's not ideal since the controller was specifically designed for hash change events.

Re: Spine -- A lightweight framework for building JavaScript web applications

#27
post #26

I like the approach of separating the dom events logic into its own controller. In backbone the dom events are tied to the view which makes it more difficult to reuse the logic with other views. I've worked around this by doing pretty much the same thing as spine; i've created a dom controller from the base controller, but it's not ideal since the controller was specifically designed for hash change events.

I think this just a terminology confusion. Spine Controllers == Backbone Views.

Both have DOM events, a "this.el" property, a "this.$" selector, and event delegation. The patterns of use should be the same.

Re: Spine -- A lightweight framework for building JavaScript web applications

#28
post #12

I'll be honest, it's an MVC JS framework centred around jQuery or Zepto. If I'm familiar with Backbone, what is going to drag me over to this - the size/number of lines of code isn't, thats for sure. Javascript frameworks are making all of the mistakes that PHP frameworks did, no differentiation and promoting fragmentation. Backbone is up on Github so would it not have been more constructive to fork it and create one…

I found the documentation for Spine much better than Backbone, or else it was just designed in a more intuitive way. Either way I wanted to use Backbone a while back, but kinda gave up on it.

Re: Spine -- A lightweight framework for building JavaScript web applications

#29
As I'm currently building a Serious Application in Backbone (dozens of Models, dozens of Views, a dozen Controllers), the differences between Spine & Backbone to me seem to come down to:

Spine does class/inheritance closer to the "JavaScript" way where properties are resolved correctly at runtime, Backbone seems a little more hackish in this area IIRC (+1 Spine).

Spine seems to have given up the separation between Controller & View. Backbone has a great separation here that has been a great aid to me in refactoring a large application. (+1 Backbone)

Backbone treats collections of Models (Backbone.Collection) as proper first-class citizens. Collections can receive & emit their own events, handle their own serialization/fetching, and make use of all Underscore.js methods (+1 Backbone)

Other than that they seem pretty similar to me. So my verdict: Spine +1, Backbone +2 :)

Re: Spine -- A lightweight framework for building JavaScript web applications

#30
> Since Spine doesn't use constructor functions, due to limitations with prototypal inheritance, classes are instantiated with inst().

Can someone explain this to me? I've been using prototypal inheritance through Closure's goog.inherits() and never had any problem using regular object constructors.

Post reply on HN