batman.js is a client-side web app framework for Coffee Script that looks rather impressive. I’m excited about coffee script and it looks like batman.js will give me the structure that I kind of need in browser world. I’m going to dig in. I have a particular web app in mind too.
In writing of a web application from scratch, it might be easy if we simply relying on DOM manipulation or some other library, but after some time we always get lost without proper structuring of our code in our application. Without having a real proper structuring in our code, we are always stuck with spaghetti code.
So it would be always advisable to use some kind of modern JavaScript frameworks that can assist us to bring a real structuring and organize our code in well manner which would be resulting in improvement of maintenance. Well in terms of structuring, a MVC architecture is the best choice. There are couple of modern frameworks presents now a days like Backbone.js, ember.js, angular.js, knockout.js, etc which can provide a solid structuring to our application. Though each of them having some of pros and cons and also are having different purpose usability, you can always choose the best one as per your needs.
So What Is MVC ?
All of these modern frameworks provide us an easy way to organizing our code using variations of a pattern known as MVC (Model-View-Controller). MVC separates the concerns in an application down into three parts:
Models represent the domain-specific knowledge and data in an application. Think of this as being a ‘type’ of data you can model — like a User, Photo or Note. Models should notify anyone observing them about their current state (e.g Views).
Views are typically considered the User-interface in an application (e.g your markup and templates), but don’t have to be. They should know about the existence of Models in order to observe them, but don’t directly communicate with them.
Controllers handle the input (e.g clicks, user actions) in an application and Views can be considered as handling the output. When a Controller updates the state of a model (such as editing the caption on a Photo), it doesn’t directly tell the View. This is what the observing nature of the View and Model relationship is for.
Why do we need Code Structuring ?
ARE YOU WEB DEVELOPER ? THEN YOU SHOULD BE KIDDING TO READ THIS SECTION. BECAUSE YOU MUST KNOW THIS MAN!
But anyway if you newbie then probably this brief description might help you.
Creating responsive, fluid, and maintainable interfaces for web apps isn’t as easy as one would imagine — there is data to be sent back to the server and the results parsed, data stores to be updated, views to be re-rendered and so much else that needs to be done in the background. There might be easy for desktop application developers with robust tools and well defined workflows. But for web developers, it's not easy. And importantly, the complexity of web application — specially on the front end always needs a proper structuring with other features. If we don't have any structuring or framework, I believe either we couldn't survive very long with our application development or needs to write and maintain thousands of lines of code.
Let's get familiar with these MVC frameworks..
As mentioned above, there are so many frameworks present that it can often be difficult to choose which best suits your needs. Picking the right JavaScript framework for your needs can be tricky. So in this articles I would described top 10 framework along with it's comparison with the hope that it might help you.
The comparison of these framework are done on basis of four major features that each of them is addressed. They are UI Bindings, Composed Views, Web Presentation Layer and how it plays nice with other.
Well, currently I am building a web application. I am using a backbone.js because it is ideal for applications with a small number of states where the view hierarchy remains relatively flat and where the user tends to access the app infrequently or for shorter periods of time. Backbone's code gets to remain short and sweet because it makes the assumption that the data backing the DOM will get thrown away and both items will be memory collected: https://github.com/documentcloud/backbone/issues/231#issuecomment-4452400. Backbone's smaller size also makes it better suited to brief interactions.
You can share your views on framework that you have found most suitable for your application.