BackboneJS : the basics

This is my first javascript framework for application development and this post is supposed to be for anyone who is just beginning with this framework. While I am still learning this framework, the points here should make one comfortable at least to get started in learning the framework itself.
First things first, here is a slide show of a talk I had given to a group regarding BackboneJS. The source code for the same slideshow (which is made with backboneJS itself) is available here.
Well, to start with BackboneJS in itself provides a structure to the web application development. It is heavily dependent on UnderscoreJS and RequireJS. RequireJS allows us to use javascript modules and load script files at one point in a .js file rather than the script tags in an html document. UnderscoreJS provides very nifty utility to ease our javascript development.
BackboneJS is supposed to be a model-view-controller framework and while we can call it like that but the real “C” here stands for “Collection”.
The view class here in BackboneJS is kind of controller. Once got the data, it can make other views or can decide which view to render at what position on the html page. There is a concept called “template” and Underscore gives that facility to us as we are developing in BackboneJS. These templates are kind of placeholders for content and once we got data, we can render html with the help of these templates.
Collection class actually is a glue between frontend and backend as its responsible to get data from server and set data in server.
I would say it a quite straight forward framework, though it takes some time to get used to the behavior of the framework. Who come to javascript frameworks for the first time will take sometime to get used to it. Though the documentation is quite good in the official website, there are things which are not documented, so it will take some time to search and undertand the concept. Overall I would say an elegant framework.
Happy coding

CoffeeScript, the first taste

On my path inside javascript land, I came across CoffeeScript which compiles to JavaScript. One week of handson to the language and I tried to write a simple phonegap application with CoffeeScript taking jQueryMobile into action. The whole project is on github, the whole of the CoffeeScript is here for your reference.

First thing I liked about the language is, it compiles to a very decent, rather I would say the best handwritten JavaScript. That itself is a huge advantage if one wants to learn JavaScript.
The code is modular and compiler is straight forward so its an immediate likable thing if one wants to code ahead in JavaScript. The community is vibrant and the official documentation itself is quite nice.
It is a must try for any javascript developer.

Things to keep in mind, and must be kept in mind while coding in CoffeeScript, are
1. The indentation should be exactly same
2. Each function returns the lastline of code in the function
(I faked it in above code by writing “null” at the end of each function)

Happy Coffee