OK, I am coming from UI design background with a bit of programming with jQuery. However, most what I did were to change UI in a linear way, no pattern what so ever. I know OOP, classes,...
I need to catch up on learning MVC pattern with Javascript. My group is picking backbone.js. So I even need to learn how to structure things around MVC. I can read on the web backbone.js usage.
But my question is: Is there a website or some book that shows some simple examples of MVC? For example, if I need to build a simple calendar, to-do task list, slide w/ text, etc.. what are the Models, Views and Controllers? And what are the jobs of each? What are some different ways to structure it? What are ways that you should NOT do?...
Thanks
Backbone.js has a todo list example on there website detailing how to use some of the features here. MVC in javascript is going to involve querying the server for data and then displaying it.
The model in MVC is the part of the application that receives content so in this case it will be receiving data from the server in JSON, XML, or whatever you fancy.
The view in MVC is the part of the application that displays content that is received via the model. It is just the data from the model displayed in a application specific format in this case HTML/CSS
The controller in MVC is the part of the application that handles application logic. In this case it will be what all the event handlers for buttons are linked with and will control when functions which load data from the models to the views are activated. Though it is not specific to backbone.js. Cake php has a good tutorial on MVC here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With