Moving Away From MVC
In the years worked in this field, working and learning new techniques, libraries and frameworks and paradigms has been a pleasure in web development. Even before frameworks, code was written for back end application which would render heavy HTML Code along with CSS and some JS code. Frameworks such as ones written in .NET MVC, django and rails helped us with predone tasks and abstraction while providing speed and reliability. With the increase in the complexity of applications and loads of user interactions and thanks to jquery we got some help with cross-browser deviations.
New Age, Old Manners
In the first 6 years of its inception, Angular and knockout was our promise for better apps and more maintainable. The learning curve is not big whatsoever and the paradigm is the same. Now we have UI components, DOM manipulations, filters, services, binding which are reusable services.
The need of quick results made people push ahead once more the main problem faced by frontend development. It was never thought of as a new area, and therefore it had no new approaches. With the advent of REST APIs and NoSQL for backend, web apps no longer are only CRUD and frontend is not based on models anymore, but composed ot them. Each view contains a lot of different models and even oddy temporary states.
In the frontend, our apps end up having a view attached to a controller that listen to its events, delegates some actions and update the models. Then the models are consumed and renders into the views.
Knowing that our views are everytime richer, and more complex, we have some transient states for them that need to temporarily saved, our controllers oftenly are not maintainable and we lose quality in our project.
To evolution out of this framework, we can take ideas from Facebook and come up with an alternative approach building up from the ground its own view framework. It is a good library to create components, one of most performant ones.
Flux is an unidirectional application architecture for managing views. Its main concern is not about the model, but the state of the views.
User interacts with views that dispatch actions which updates the stores and finally renders the views. Although, it seems a bit awkward in the beginning, you make your app more predictable.
This is actually an improved MVC Framework
- There is no app without data and in our state of the art they are REST APIs, so models still exists
- Actions and dispatches consume, process data and update stores
- View is just a representation of your state.