Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript AngularJS MVC Frameworks in AngularJS Why Use an MVC Framework?

Noah Lubko
Noah Lubko
1,830 Points

I cant see the benefit of mvc

It looks like every thing you said about mvc can be done by Jquery to. Please can you elaborate on the advantage of mvc?

4 Answers

MVC applies to more than just javascript. It's a popular architecture pattern that helps separate presentation, business logic, and data layers. This separation often makes it easier to manage application development and easier for multiple developers to work on it at once.

http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

geoffrey
geoffrey
28,736 Points

I'm not an expert yet, but I have a little experience with both.

What I can say is:

With JQuery, you have no data-binding that you have with Angular JS. This means that the vue and the model (the datas) are synchronized within AngularJS, which isn't the case with JQuery.

A good example in action of this behaviour might be seen here, play with the input you'll see the vue automatically updated:

http://www.angularjshub.com/examples/basics/twowaydatabinding/

Moreover, the example the teacher shows in the video is as well a good example. As you probably noticed, he could build the same list of people with less code using AngularJS. Without concatenating all the information that need to be displayed as you would do with JQuery.

At first you might think that's not that much a big advantage, but when you build a "big" app, that's really handy...

Depending on the project, just for this, I'm going to use more Angular now, there are as well some others good reasons to use that are beyond the scope of my knowledge at the moment...

Taras Vlasov
Taras Vlasov
3,463 Points

I believe that the main benefit of using the MVC pattern is to have the so-called "Separation of concerns".

With MVC you are layering your app, thus making it easier to maintain and test. Though I believe it is possible to achieve it with the pure JavaScript coding, AngularJS makes it incredibly EASIER.

jason chan
jason chan
31,009 Points

Frameworks = less code to do more.