MVC or MVP or MVVM
(Model-View-Controller / Model-View-Presenter / Model-View-Viewmodel)
(The choice depends on what suits you best and what you want to do)
This way you split the application rules into layers.
In the Model, you can create all entities and core business rules in one Webservice in any language or platform and, from it, make the data available and interact with your website, without there being a real link between them. Only one contract Model Public Interface for Fronend.
Advantages of layering
Split your application by separating the View
code you have several advantages:
- Reduction of network traffic
- Reduced application server load
- More dynamic and fluid navigation
- Independence between Front-End and Back-End teams that only need to establish the roles and signatures of the methods that will be exposed
Frameworks
Among these frameworks I can quote:
It is a Viewmodel Model View framework that provides Two-Way binding
between DOM and Viewmodel in javascript
Causes the DOM to update when there is an update in Viewmodel and updates the Viewmodel automatically when there is a change in the DOM
I have a few things delayed here, so finish add more to the answer with the other frameworks and examples
Ember.js is a Javascript framework for client-side web page development based on the MVC architecture. It allows you to create SPA (Single Page Applications) in a scalable way, incorporating many features as well as self-upgradable templates based on Handlebars.js
Angularjs is a MVW (Model View Whatever) framework that allows you to use (to be continued...)
Yes, it’s acceptable and it’s on the rise. It’s called Singlepage Application or SPA. There are several frameworks like Knockoutjs, Emberjs, Angularjs, Backbonejs that do DOM control and MVW rule maintenance (Model View Whatever)
– Caputo
I do not understand what kind of improvement could be taken advantage of, creating all the layout in javascript, I think that for static content, use only html, ensures much more the display of the page, because if the user is with javascript disabled, your entire site, will not be neither viewed.
– Marcelo Aymone
Yeah, state content would be in HTML. Javascript would only be responsible for making requests on the server to get the JSON information and take control of the DOM like you said. It’s easier to research now knowing that this is called SPA and with your frameworks suggestions. As for javascript disabled, it is a bad thing that I will have to combat, force users to enable. In fact, I don’t even care about it, since it will be a commercial/business application with specific users and all would be trained to use and obviously would not disable javascript.
– Gustavo Piucco
In this case yes, it is advantage, as it is an ERP, there is no need to worry about SEO, which is a problem when talking about Ajax requests, which there are also techniques to circumvent...
– Marcelo Aymone
@Gustavopiucco I do not know if you have already started but I recommend a look at the nodejs to do the backend. It has great performance and scalability, and the learning curve is not so great for those who already know Javascript
– Caputo
I haven’t started yet. I am aware of Nodejs, only that as I am thinking in the long term, as Nodejs has apparently come out of the oven now, I don’t know what the future of its development will be, I feel safer developing in PHP, maybe I’m wrong.
– Gustavo Piucco
Yes, for an ERP it looks good. BUT... there has to be a very serious commitment to the adopted standard. The moment you start delivering HTML inside a JSON, abandon the :D boat
– gpupo
@Gustavopiucco has little time for us Brazilians, but Node has more than 2 years and is being embraced by numerous large companies. As you said yourself, as it is in the long run, a technology that is already emerging today may be a good choice.
– Caputo
Or Angularjs, from that little company...
– Marcelo Aymone
@Gustavopiucco Was something missing in my reply? Can you add a comment that I will try to complement
– Caputo