8 Reasons Why Follow.js Could Be Useful for You

Posted on May 15, 2012 by Nikhil P Naik

Building Web services with more logic and dependencies between different parts of the application it is recommended to use the separation of application logic and its display. Usually you can find this services in patterns such as MVC (Backbone.js) or MVVM (KnockoutJS).

Follow.js — is a small framework that provides handy API for working with the model of the JSON-format. There are receipt and appropriation of data, the organization of data changes tracking, the construction of the dependent field model (dependent observable) and other. Use it with Follow.js favorite template and framework for working with the DOM and get a complete tool for separating application logic from the data.

 

Reasons

1) Providing with unit tests.

2) All data in the model is observable. You can subscribe to a change in one or many “chains” in the model. For example, in knockoutjs to create only one observed variable in the model ko.observable (‘default-value’) is used. Creating Follow.js, the slogan from jQuery – «write less, do more» was followed.

As an instance of the model is a function, we can change the behavior of this object in the context of the line, it means overloading a method toString (), so the alert (model) will return is the line representation of the model (transparent call model.toJSON)

3) Lightweight library (~ 20 kb in a minimized form, gzip it will be very small.) For comparison, the weight of other libraries that solve similar problems:

  • Ember.js – ~ 150Kb
  • Backbone.js – ~ 17KB (excluding Underscore)
  • Knockout.js – ~ 42KB

4) Use your favorite framework for working with the DOM and the template system (jQuery + Jsrender are recommended)

5) Easy integration with other libraries and back-end of part of your service through JSON-data model. You will receive the current model condition at any time of the application’s work model.toJSON ([chain]) and send it to the server.

6) The main part of any pattern working with the data, such as MVC and/or MVVM – is work with the model. That’s why all the attention in Follow.js is focused on the work with the model. Templation of data or working with the DOM is not its concern. When each tool solves its own problem and at the same time it is combined with the other that’s just great.

7) Familiar work with JSON in dot-notation and easy access to the data. It means that getting the information on var settings = model (‘user.data.settings’);equivalent to writing JS var settings = user && user.data && user.data.settings! == undefined? user.data.settings: null;

You no longer have to worry about checking of dividing all the parts of data access chain.

8 ) Ready-integration with the project “from the box”, working on XSL / XML. The principles of work are simple:

  • Anywhere in XML-document you can build specifically designed mappers (XML) for the data assembly.
  • In XSL-document you can call a template that will process mappers, generate JSON and give data to the client (JS)

So now you can see that Foolow.js is really useful tool that couls extremely simplify the life of the web developers, because it makes coding much easier.


About the Author:

The article was provided by Andrew Smith, QArea Inc. – IT outsourcing services.

Facebook page: http://www.facebook.com/qarea.inc

Follow us on Twitter: https://twitter.com/#!/QArea

 

About Nikhil P Naik

Nikhil Naik has finished his graduation in the field of IT and is currently mastering at the University of South Florida. He also loves watching cricket, listening to music and travelling. Twitter Handle - @buzz_nikhil.

Leave a Comment

*