Reputation: 15303
I am trying to understand the "MVC" backbone.js. I came across a article that describes jQuery as a non-MVC framework, but I don't understand what that means.
I am doing all DOM manipulation using jQuery, and everything works fine.
Can anyone explain, with a simple example?
Upvotes: 0
Views: 778
Reputation: 66663
An MVC framework essentially provides facilities using which you can clearly separate out the M (Model - the data), V (View - what your user's see) and C (Controller - the logic, the middle-man working with M and V) parts of your application. CakePHP, rails, and backbone (on the client side) are all examples of MVC frameworks.
jQuery does not do any of that. It is not a framework, it is just a collection of utils/conventions (thats an understatement by all means) to make your life a lot easier when working with JS and DOM in general.
For example, lets say you are working with an image editor, then:
And the class/script that loads your image from db/disk and renders it using editor.php will be your controller
Lets say your controller uses libjpeg to encode your image. libjpeg is just a library that helps the controller do its job well. libjpeg itself has nothing to do with your M, V or C.
jQuery is analogous to libjpeg above, it has nothing to do with how you structure your aplication, but helps your view in doing its job.
Upvotes: 5