3 ms·
This is a very interesting look at things. I'm currently building a backbone-based frontend in a very similar way, only without the node.js counterpart - yet.
by moe 16y ago
This is a very interesting look at things. I'm currently building a backbone-based frontend in a very similar way, only without the node.js counterpart - yet.
One problem I immediately see in this hybrid approach is the requirement to keep the state for all [active] users in memory on the server. This does not scale well - which is why conventional web development tries to be as stateless as possible.
It's not hard to remedy this partly by adding basic lazy-fetching and cursor capabilities to Collection. But you lose some of the most interesting features in the process (push-notify on changes), and preserving those at the same time becomes much more tricky then (bordering on classical ORM problems).
There's also still ground-level stuff missing in Backbone, i.e. the support for recursive updates of nested collections (e.g. from one big, nested json blob) is just not there yet. A few approaches have been discussed, but afaik not implemented yet. The models need to be beefed up with some sort of schema (e.g. json-schema) to truly solve this one.
However, none of that is insurmountable. All it takes is some more of the smartness that the Backbone developers have already demonstrated. And elbow grease.
For example I'd love to see backbone paired with 'dnode' or a similar RPC approach. That might open amazing possibilities.
- HenrikJoreteg 16y agoThanks for your feedback. I've just been playing with this stuff and wanted to put it out there despite its warts. Regarding the scaling issue. Yes. This is definitely a weakness (I actually mention it as a weakness in the last paragraph or so). We're working on a solution for that using redis as a sort of shared memory. But it's just not ready for primetime and I just figured I'd write up what I had going so far. Regarding recursive updates of nested collections, the "mport" function in the post works well for re-inflating the entire state. But not quite as well for updates, but for this type of thing, I prefer piecemeal updates anyway, so we don't have to send as much data each time. I'm definitely gonna check out dnode some more as well. Cheers.
- moe 16y agoI've just been playing with this stuff and wanted to put it out there despite its warts. And thanks for that! In hindsight my first reply came out more nitpicky than intended; all my concerns are aimed at (still to be fixed) shortcomings in the backbone/node ecosystem, not at your particular implementation. Major kudos for not only coming up with (at the very least) an intriguing Proof Of Concept but then also writing a great blog post to describe it. This will be learning material for myself and many others.
- HenrikJoreteg 16y agoThank you. No offense taken :)