justspamjustin / BossView

Manage your Marionette.js views like a boss! Manages events and rendering of sub-views.
http://justspamjustin.github.io/BossView/
MIT License
48 stars 6 forks source link

Recommend looking at Backbone.Babysitter to manage sub views #2

Closed mxriverlynn closed 10 years ago

mxriverlynn commented 10 years ago

Hi again!

I took a look at your code quickly and noticed that a lot of the code you have in here is managing your list of sub views. There seems to be a lot of loops and callbacks with the eachSubView method, and other bits of code that look very familiar to what I've built in to Backbone.Babysitter already.

I think you might benefit from using Backbone.BabySitter, honestly. I think it could help to reduce your maintenance costs and code by re-using the part of Marionette that already handles management of sub-views, looping through them, and manipulating them.

Really what this comes down to is saving you some code. Since Babysitter is already part of Marionette, and you've built a great extension to Marionette, it makes sense to try and take advantage of what's already there.

https://github.com/marionettejs/backbone.babysitter

Let me know if you have any questions about BabySitter, or if you don't think it would fit your needs. I think it will off-hand, but I haven't really fully understood everything you're doing, yet.

justspamjustin commented 10 years ago

@derickbailey thanks for reviewing the code! I will take a closer look at babysitter and see what I can advantage of.

justspamjustin commented 10 years ago

I looked at this pretty closely and I think I'm going to leave this as it is for the time being. I'm not sure we would benefit greatly from using babysitter. The eachSubView function is used to iterate over the map of subViews whereas babysitter is centered around having a container that is a collection.