Hello, Backbone.js

When I started learning backbonejs using Etsy as my API to grab the information, it was a bit overwhelming. Even so, I was only using the backbone’s router only—no views, models or collections.

Now when I was finally starting to get used to the router, we moved on to learn the rest of the above mentioned and now it has my head spinning once again.

When we were just using the router for our etsy project, we were basically doing everything that a view would do but without actually using Backbone.View. For example, if I were to click on a listing picture on my webpage I created for the etsy API, the router (based on my code) would catch the URL change and therefore run what it was coded to do. In my case, I told the router that when the URL changes to a specific link, go grab my template file and the information from the API and render it to the page.

I believe what made it a little bit harder to get a grasp on backbone was because I saw that I could do two parts, maybe even three (Backbone.Router and Backbone.View; Backbone.Model?) all in one part of backbone—the Backbone.Router. I just thought, “hey, I’m just getting comfortable with using the router to do everything… I don’t want to add something that’s going to cause more headaches.” Maybe my ears may have skipped something in our lecture but that’s how I was thinking beforehand.

The main problem that I believe I am having now, after being introduced to the rest of Backbone.js, is where to actually put certain pieces of code that enables the Backbone parts to “talk” to each other. Eventually, with more practice, it should become clearer to me, hopefully.

Of course there are reasons behind how and why Backbone should be used. For starters, M-V-C(*) separation will definitely help to organize code and to allow it to be scale-able and modular.

And then there’s also single page apps!

There shouldn't be a need for that refresh button anymore when only certain parts of your web app or website need their views to be changed when updated or acted upon (via events). Our instructor used GMail as an example. When you’re clicking to compose a new email, the page doesn’t refresh. Nor does it refresh when you’re clicking into your inbox or even the chat system. This is similar to how Backbone.js would work.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.