Rojakcoder
Of Linux, Programming, and Singaporean Ramblings

More tips for BackboneJS

Fri, Feb 19, 2016 6:27PM +0800

Some time back when researching for Backbone JS stuff (I can't remember for what now), I encountered this post Lessons learned while working with Backbone.js.

This post was written a few years back, but I was still able to glean some gems from it. Specifically, the section "Simplified Object Copying" was something that could be applied on plain vanilla JavaScript.

The other section "Changing in referenced object does not trigger events" was something that I had already discovered on my own. The author's solution was to create a copy of the object to assign to the model. In my work, I had chosen to manually trigger the change event. In terms of correctness, I guess creating a copy and re-assigning to the model would be more so since that would trigger both the general change event as well as the change:name event.

While I like to think that this could be one of my last posts on BackboneJS, with Angular JS being the new hotness, I'm facing a bit of inertia in switching to Angular. No doubt Angular is newer (I think) and coming from Google, isn't likely to disappear in oblivion anytime soon, the rapid change from Angular 1 to 2 is a bit disconcerting. Being a solo developer, I don't have the luxury of time to always keep chasing after the new kid on the block.

Even though the quick start guide says that npm is only a recommended component, my guess is that development without npm is going to be painful. I've never had the chance to truly understand the ins-and-outs of npm, so I won't be able to work around it effectively. I always have a resistance to using development environments that require other components before any effective coding can start. This means that every time I change a machine, I always have to run through a (mentally) tedious setup process. It also means that if I have a different development (one at home and one at the office), I need to keep the development environments on both machines the same in order to do my work effectively.

So, yah, I guess I'll be sticking with BackboneJS for some time in the future.

comments powered by Disqus