Wednesday, May 14, 2014

Angular, Backbone or Ember: Which JavaScript Framework best for you?

Developers use JavaScript for a number of different web applications. If you continue adding more code to make it work in multiple browsers and use cases, it can quickly become a big mess. Hence you’d better use a framework to avoid this.
Frameworks like Angular, Backbone and Ember make your JavaScript code structured and keep it organized. Being all open source, they’re constantly improved by the community. They also save your time as they’re built on top of JQuery, a fast and powerful library that makes some of JavaScript’s complex operations easier to perform and more readable.
However, choosing your JavaScript framework isn’t such easy and could be challenging. Let’s try to understand how Angular, Backbone and Ember are different from each other and what their strengths and weaknesses are.
AngularJS
AngularJS is an open-source web application framework, maintained by Google and community, that assists with creating single-page applications, one-page web applications that only require HTML, CSS, and JavaScript on the client side. Its goal is to augment web applications with model–view–controller (MVC) capability, in an effort to make both development and testing easier.
AngularJS was originally developed in 2009, and it is the oldest of the three frameworks. It also has the largest community. In 2013, Angular was fourth in number of project contributors on GitHub and third in number of stars gain which testifies to its huge popularity. Moreover such well-known companies as Amazon, Google and Nike credit AngularJS as JavaScript framework. There are also a lot of news sites using AngularJS on their front pages, including the Guardian, the Huffington Post, and MSNBC. You may also check https://builtwith.angularjs.org/ to have a look at good examples of Angular apps and experiments.
Pros
  • Ideal for complex “client-side” applications, where the complexity is more in a way “components” of an application interacts with each other than in a way they synchronise and/or interact with backend
  • Very clear separation of concerns
  • Uses concepts that kind of look like the future of HTML/DOM (DOM templates, binding attributes).
Cons
  • A bit complicated to grasp. A lot of new concepts
  • jQuery or another dom parsing framework in directives may be painful to use because of the way angular compiles templates
  • Good for application with a big level of complexity on the client side, but you’ll have to learn a lot of new stuff.
On the whole, AngularJS is a robust and viable framework for building generic web apps. Whether it lives up to the expectations of being the most dominant JS framework for web development is yet to be seen.
Backbone.js
Backbone.js  is a JavaScript library with a RESTful JSON interface and is based on the model–view–presenter (MVP) application design paradigm. Backbone is known for being lightweight, as its only dependency is on one JavaScript library, Underscore.js. It is designed for developing single-page web applications and for keeping various parts of web applications (e.g. multiple clients and the server) synchronized.
Backbone came out in June 2010, and its community is nearly as large as Angular’s. Many popular applications such as Twitter, LinkedIn Mobile and Foursquare use Backbone framework. Also a number of music apps were built with Backbone, including well-known Pandora, Soundcloud and Pitchfork.
The download size of Backbone is very small compared to other frameworks which is its biggest advantage, since it only depends on one JavaScript library instead of several. Moreover, this framework is remarkably hands-off. This means experienced JavaScript developers can quickly get started. However less experienced developers might find themselves writing a lot of “boilerplate” (repetitive) code. If you’re having trouble Backbone has an especially active community rife where you could find free tutorials for getting started with the framework.
If you’re working on a single-page application or widget and you’re comfortable with being a self-starter—Backbone is likely the right choice for you.
Pros
  • Very easy to start with
  • Very small
  • Free to use any templating engine
  • A lot of excellent documentation
  • Good Community Support
  • Very popular (According to Github, Stackoverflow statistics)
  • Very flexible in how you may want to use it
  • Minimalist library
  • Easy to learn
Cons
  • No two way data-binding
  • Dependency on different frameworks like jQuery and Underscore
  • No provision for handling nested views
  • More work required to build large scale applications as compared to Angular or Ember
  • Code can become messy
  • DOM manipulations are left to the developer
  • Performs slower than AngularJS
Ember
Ember.js is an open-source client-side JavaScript web application framework based on the model-view-controller (MVC) software architectural pattern. It allows developers to create scalable single-page applications by incorporating common idioms and best practices into a framework that provides a rich object model, declarative two-way data binding, computed properties, automatically-updating templates powered by Handlebars.js, and a router for managing application state.
Ember is the newest of the three, but it’s already making waves. LivingSocial, Groupon, Zendesk, Discourse and Square are some of the most well-known applications that have adopted Ember. Ember’s creators say it’s easy to see when a site is using Ember because of its loading speed.
At 69K minified and zipped, Ember is the largest framework of the three. Ember’s larger library size partly explains why it’s the largest download of the three Javascript frameworks. Another reason for it is that Ember comes with a lot of built-in support for standard code features.
Ember’s library size and support network are its two greatest strengths, but if you’re only trying to create a small widget or single-page app, it might be overkill for you. If you’re working on a multipage, navigational, long-term project, Ember might be the right choice for you.
Pros
  • Good for long running and complex applications with deep nested view hierarchies
  • Aggregates model data changes and update the DOM late in the RunLoop
  • Well defined models and computed properties
  • Use HandleBars as templating which is flexible
  • Provides auto updating computed properties
  • Test driven
Cons
  • Relatively new framework
  • Steepest learning curve out of the three
  • Payload is the largest out of all three
  • Dependency on jQuery and Handlebars
  • Poor performance as compared to AngularJS
  • Documentation is not very good
  • Two way bindings are not implemented well
As I could see from a number of forums about JavaScript frameworks, many love AngularJS. What about you? Which one framework is your favorite one and why? Please feel free to share your thoughts/experience in the comments below

No comments :

Post a Comment