Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript frameworks: What are UI bindings and composed views?

I'm reading this:

http://codebrief.com/2012/01/the-top-10-javascript-mvc-frameworks-reviewed/

I'm using backbone.js. I love it, though it requires too much boilerplate. Anyway.

The author of the post seems to put great importance on UI-bindings and composed view.

I think I know the basic advantage of ui bindings, you can change small parts of the view as the model changes without re-rendering the entire view. I don't necessarily see the point though. If your view is huge maybe you should make smaller views? I've seen knockoutjs's code and it's littered with ugly data-bind stuff. How does emberjs handle it? Is there an example?

I have no idea what he means by composed views, could someone elucidate?

Composed Views - Like all software developers, I enjoy creating modular reusable code. For this reason, when programming UI, I would like to be able to compose views (preferably at the template layer). This should also entail the potential for a rich view component hierarchy. An example of this would be a reusable pagination widget.

Is there an example?

Thanks

Edit:

Would this help make something like composed Views?

https://github.com/tbranyen/backbone.layoutmanager

like image 811
Harry Avatar asked Jan 26 '12 03:01

Harry


People also ask

Is JavaScript a UI framework?

JavaScript UI library and framework help the web developers to easily build a clean, easy, consistent, and attractive user interface. Today, over 10,000 JavaScript UI libraries are available for web developers. But the question arises which is the best among them.

How many types of JavaScript frameworks are there?

The five most popular JavaScript frameworks are Node. js, Vue. js, AngularJS, Ember. js, and React.

What is JavaScript and its frameworks?

In brief, JavaScript frameworks are a collection of libraries containing code written in JavaScript, making life a lot easier for software developers. Each JavaScript framework offers pre-built codes for different areas and different purposes in software development.

What is difference between JavaScript and framework?

JS libraries give developers predefined methods and classes to help them work faster and more efficiently. On the other hand, the JS framework acts as a framework for developers to construct apps for specific platforms.


2 Answers

Composed views are used to divide the view into small blocks which can be reused or adapted to different scenarios.

For example, in a form where you are editing a user, you could create a view for the address field and just call it from the main page/template. The author mentions pagination as an example too, in this case you could create a model that knows how to handle retrieving data as you switch between pages and just apply it to a table in your page.

Regarding the "ugly" data-binding code, backbone needs to know how to attach itself to the existing markup and how to modify it when an event occurs.

Maybe this example will help: http://coenraets.org/blog/2011/12/backbone-js-wine-cellar-tutorial-part-1-getting-started/

like image 144
Bruno Silva Avatar answered Sep 23 '22 19:09

Bruno Silva


Traditional web pages are monolithic. User calls a page and server constructs the page and browser renders it. Here author is referring to breaking down that kind of code in to a set of views. So your page is made up of multiple parts. And each part gets rendered and updated independently. Or one model change can trigger a series of updates on some or all parts.

Basically this allows you to create 'desktop' kind of applications on web. And you don't have to resort to iframe hacks to do this.

Gmail and Google Reader are good examples of web applications built with composed views.

like image 42
chandmk Avatar answered Sep 20 '22 19:09

chandmk