Page layout controlled by javascript using REST for dynamic content

4

I was thinking of a different pattern for developing my application via browser. As this is an ERP, I need a quick interface that does not need to download the HTML from the server at all times to print the user's screen layout. The solution would be to make the whole interface in javascript by pulling the dynamic content via PHP REST with JSON. The server would only be responsible for printing a JSON to return only primitive variables such as texts, integers, boolean, and arrays.

Questions:

1.

Is this an acceptable and professional design pattern or is gambiarra?

2. Is there a javascript framework that saves me work on the javascript side for this purpose?

What are the pros and cons of using this design pattern ?

    
asked by anonymous 08.07.2014 / 18:44

1 answer

5

MVC or MVP or MVVM

(Model-View-Controller / Model-View-Presenter / Model-View-ViewModel)
(The choice depends on what fits you best and what you want to do)

This way you divide the rules of the application into layers. In Model , you can create all the major business entities and rules in a WebService in any language or platform and from there make the data available and interact with your page Without a real link between the two. Just a contract from the public interface of the Model for FronEnd.

Advantages of layering

Splitting your application by separating View from the code you have several advantages:

  • Reducing network traffic
  • Application Server Load Reduction
  • More dynamic and fluid navigation
  • Independence between Front End and Back End teams that only need to establish the functions and signatures of the methods that will be exposed

Frameworks

Among these frameworks I can cite:

KnockOutJs

It is a Model View ViewModel framework that provides Two-Way binding between the DOM and the ViewModel in javascript

Causes the DOM to refresh when there is an update in the ViewModel and update the ViewModel automatically when there is a change in the DOM

I have some delayed things here, so I finish complementing the answer with the other frameworks and examples

EmberJS

Ember.js is a Javascript framework for client-side web page development based on MVC architecture. It allows you to create SPA (Scalable Single Page Applications), incorporating several features besides self-updating templates based on Handlebars.js

AngularJs

AngularJs is an MVW (Model View Whatever) framework that allows you to use (to be continued ...)

BackBoneJs

08.07.2014 / 18:57