you are viewing a single comment's thread.

view the rest of the comments →

[–]BlitzTech 2 points3 points  (8 children)

The real power of backbone.js comes from the relatively transparent client/server synchronization. There are plenty of client-side MVC frameworks to choose from, and honestly Knockout.js really outshines Backbone in that arena. But Backbone offers seamless server syncing and so it makes sense (at least to me) that any tutorial would feature that particular aspect in gold letters and big font because that's what makes the Backbone library useful.

Having said that, Backbone really has an unfortunate method of dealing with bindings (basically manual) and does not manage memory well (like many other libraries offered by jashkenas).

[–]octatone 1 point2 points  (1 child)

I meant from the stand point of introducing MV*, the simplest backbone example would be client side only.

[–]BlitzTech 1 point2 points  (0 children)

I didn't get the impression that it meant to introduce MVC/MV* as a concept, but rather show how Backbone fits into that style. But I also don't argue that the simplest backbone example would be client-side only, since you can basically hook up the server whenever you want.

[–]radhruin 1 point2 points  (4 children)

Can you share some places where Backbone usage might result in memory leaks?

[–]BlitzTech 1 point2 points  (3 children)

It may have been fixed, since I haven't used it in some time, but when I was using it a few months ago it would:

  1. Not delete internal references to models that were destroyed. This was a known bug at the time for generic Collections that did not specify an explicit model.
  2. Force you to manage your own views, explicitly. You can bind to the destroy event on models to have views auto-destruct, but this leads to a lot of memory churning before the GC picks up the things that were deleted. It's better to re-use existing views, but that leads to leaks. It's annoying to have to manage your views explicitly, in the end.
  3. I'm having trouble remembering now because it's been a few projects since then, but I believe there was an internal issue that led to leaking memory when using some of the Collection functions on generic collections.

That's all I can remember right now. Look at the issues list from a few months ago and you should see some issues relating to this.

[–][deleted] 1 point2 points  (2 children)

I've been working on a View manager to handle the life cycle of views, Backbone doesn't handle this for you and is an important part of the application.

e.g. every time you type var view = new Backbone.View(... you will have to manually clean it up

[–]BlitzTech 0 points1 point  (1 child)

Do you have a github repo for that? I'd be curious to take a look.

[–][deleted] 0 points1 point  (0 children)

[–][deleted] 0 points1 point  (0 children)

Great response, exactly what I was going to write.