PDA

View Full Version : MVC explanation,



Kurt001
21 Mar 2011, 3:51 AM
Hi there,

never programmed EXT before. I do understand that it is best practice to split things into views models and controllers.
So I started to split things into the recommended folders as there are:
app -> controllers, models, stores and views

What exactly is a controller? How do you define a view (Eg. if I have one panel and fill it with a list, that is pretty clear, but what if I have three panels inside one card. What if I have three cards sliding into a carousel. Where does one view end and the next start)?
What are models. Is a model a list with the model and the store?

What is best practice how to split up things.

Best
Kurt

d5chris
21 Mar 2011, 1:35 PM
A good place to start, if you have the time, is to read the ruby on rails guides on MVC - they explain the concepts quite neatly: http://guides.rubyonrails.org/

But in short:
A controller is mapped to a url (in this case, the bit that comes after the '#' in the url). Its job is to then bring up the appropriate view and initialise it with data.

As for models, if you think of a database: a model is a single record, and a store is a table.