Backbone.js best practices for n00bs


The other day I was looking for some Backbone.js tutorials on the internetz, something that could give me some clue about how to properly structure a web application using this framework and I found a not that old (one year and a half now) blog post talking about how to do a trivial Backbone.js application. A professor at college told me once that the best way to learn to write good code is reading good code. I’m not quite sure he was completely right, but the man had got his point.

Even though the Backbone.js ’s official documentation says that There’s More Than One Way To Do It, I do agree with something that Yehuda Katz said at the Railsconf 2012 about Rails: The Next Five Years, and it’s that convention over configuration rules. I think it is really cool that Backbone.js let you do things the way you see them fit, but I think it is the author’s responsibility to spread the world about, at least, common practices, so that we don’t end up with something like we currently have, which is a lot of people trying to figure out what’s the best approach for solving certain problems, then debating, arguing, flaming, trolling, bitching, etc. If you don’t believe me, ask for projects like Git, Ruby, Ruby On Rails and Linux, where there is a “dictator” and people just follow rules. You don’t really need to agree with this. It’s just my personal opinion.

I want to say that by the time this application saw the light, Backbone.js was on its version 0.3.3. Now it is has been a year since that example was created and I want you to check the source code posted on that blog and check my version on GitHub to see what’s the difference.

Anyways, I have to say that before I read this blog post that I’m talking about, I had already watched Backbone on Rails Part 1 and Backbone on Rails Part 2 so I had a clue on what’s a good way on doing things on Backbone.js + Ruby On Rails. You can see the application running here and the source code here.

comments powered by Disqus