Moving Away From MVC

Web Design Company in India

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.

But it was noticed that with the lack of responsivity, performance at low resources and richer user interaction lead us to reinvent web development. This lead to 6 years of revolution in javascript frameworks such as knockoutjs, which came out with a mission to surpass old necessities.

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.

What is the Misconception of MVC and Javascript

Javascript is not a natural Object Oriented Programming language, and the use of MVC was grown for such languages. We have the same group of values being referenced in different areas related to different controllers. Any update on these models should reflect different results and behaviors.

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.

Evolution

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.

 

label, ,

About the author