Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reason for using a JavaScript MV* framework? [closed]

I have a e-commerce website, and it is a little JavaScript intensive (conditional filtering for price, brands, etc. AJAX calls, etc.). I have a lot of cluttered JavaScript/jQuery code on my website (views not separate, no reusability, etc.), and we're planning to rewrite the code.

To solve the problem, I came across KnockoutJS, and on further research, Backbone.js, AngularJS, Ember.js, etc.

I looked at most of the popular websites, like SO, GitHub, Amazon, Ebay, etc. and it seems none of these websites use any of these frameworks.

What I cannot seem to figure out is the use case for using these frameworks. The wikipedia pages suggest these are designed for single page apps.

  1. Is it worth the effort to implement the above for a traditional e-commerce website?
  2. Are there any downsides to using any of the above frameworks ?
  3. Is there a reason why a lot of popular websites are not using them ?
like image 587
0_0 Avatar asked May 13 '13 11:05

0_0


People also ask

Why should I use a JavaScript framework?

JavaScript frameworks are often considered essential tools for modern frontend web development. By employing any one of the numerous frameworks, your developers can build scalable, dynamic web-based applications that can be used within your company — or even by consumers, customers, or clients.

What is MV * framework?

MV* is Model-View-Whatever architecture. The term is being used in AngularJS, where the Model represents (Data) any variable from javascript or something, View represents HTML side, and * i.e whatever represents whatever that binds these two together.

Do you need a JavaScript framework?

JavaScript frameworks are an essential part of modern front-end web development, providing developers with tried and tested tools for building scalable, interactive web applications.


2 Answers

These frameworks are designed to make your code easier to maintain and to improve the user experience by creating single page applications, in this kind of apps the navigation is more fluid because everything is loaded via AJAX if you want to learn more about it you can start with http://en.wikipedia.org/wiki/Single-page_application.

Another advantage of this sort of applications is that you are going to need an HTTP API to be the access point to your data access layer (DAL) from the front end. When you have a HTTP API your DAL is 100% independent of the data presentation layer this means that in the future you will be able to re-use it to create other apps like for example mobile apps, you can even use tools like phone gap to auto generate the mobile apps for you if you follow this approach.

You can also save a really big amount of time auto-generating your HTTP API by using tools like http://deployd.com/. So we can say that following this approach provides a better user experience, is faster to develop and easier to maintain and test that's why it is so popular. Big companies like Google (angular.js) and twitter (https://github.com/twitter/flight) are using it but they just created their own one.

If you find complicated to decide what framework to use take a look to http://todomvc.com/ they provide with the same example (a TODO application) in each of the available frameworks so you can pick the one that you like more.

Hope it helps :)

like image 69
Remo H. Jansen Avatar answered Nov 10 '22 15:11

Remo H. Jansen


I work for some bigger company as javascript developer. We have about 30 web projects. But we don't use any MV* for javascript.

1) I think that it doesn't worth till you have only few javascript developers. It is better to have set of widgets and reuse widgets from this set. Each widget is an object in our case. Javascript is mainly view so why to separate it into more parts?

2) The main downside is that you are trying to use too big hammer, so it extends development time. Filtering, searching, sorting, ajax and other stuff are very common and simple problems. You don't need MV* patterns for these.

3) Supranational organizations can afford it. Also you can find it in some webGL projects (games) and similar things. Others don't need it.

Also don't forget that "premature optimization is the root of all evil". Good frameworks and clear code can help you in the future, but it can also stop you in the present!

like image 34
Entity Black Avatar answered Nov 10 '22 14:11

Entity Black