Hacker News new | ask | show | jobs
by bchhun 5539 days ago
wasn't this backbone.js ? the TODO example is the same one !!
3 comments

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 comment-less. It also doesn't include any of the collection mapping, filtering, and aggregation functions, which contain a large part of the usefulness of Backbone when used with real models.

The size difference may be more meaningful once the hard dependency of Underscore.js is taken into account.

That said, competing so closely with an Ashkenas library is not a niche I'd want to be in...

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 resolved at runtime."

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

from the FAQ:

> Whoah - your API looks really similar to Backbone. Why should I use this instead? > Well, it's true that Spine was inspired by Backbone, an excellent library, and its controller API is very similar. However, the similarities end there. Internally the library works very differently. For example, Spine has no need for Collections, which are required for pretty much every model in Backbone. Spine provides a class library, and has very different ideas when it comes to server sync. Lastly, Spine is much simpler and half the size, go and check out the source.

From the FAQ:

"Well, it's true that Spine was inspired by Backbone, an excellent library, and its controller API is very similar. However, the similarities end there. Internally the library works very differently. For example, Spine has no need for Collections, which are required for pretty much every model in Backbone. Spine provides a class library, and has very different ideas when it comes to server sync. Lastly, Spine is much simpler and half the size, go and check out the source."

http://maccman.github.com/spine/#h-faq