As many of you know, Backbone.js is a well-known MV* framework. It’s hosted on GitHub and it gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
In this article we’ll use a built-in feature of Backbone called Events to implement an asynchronous messaging paradigm to avoid coupling. The idea is to separate groups of code that are highly dependent on one another.
The example I’m going to show is a graph visualization tool where data is beautifully synced cross users. The use of WebSockets will make it possible to open an interactive communication session between the user’s browser and a server.
The goal is to keep the example as simple as possible. The concepts learned here will help you a lot in reducing coupling. In addition, this is a very helpful approach for building extensible, flexible, and maintainable code. At the end of our experiment, we’ll have the following result:
Backbone.js
Backbone.js is a framework to build single-page applications by providing models, views, controllers, collections, and custom events. Its structure helps us to separate the user interface from the business logic. In this article I’ll introduce you to only on some of these elements but in case you want a more in-depth guide, I suggest you to read the article "Backbone.js Basics: Models, Views, Collections and Templates".
Continue reading %Build a Web App with Backbone.js and Socket.io%
by Igor Ribeiro Lima via SitePoint
No comments:
Post a Comment