In Model-View-Controller pattern should the controller fetch the data or the the model?
-
In Model-View-Controller pattern should the controller fetch the data or the the model should update data based on inputs from controller ?
-
Answer:
If you want to get data, the model should fetch the data, and the controller should query the model for that data. If you want to update data, the controller should pass the data to update to the model, and the model should update the data.
John Kurlak at Quora Visit the source
Other answers
fetching the data from the database/api should be handled by the controller. Inputs from the View/UI and updating the UI based on inputs (Your Business Logic) is both Controllers' and Models' work. They are mainly different topics. The main reason to use MVC is the separation of Concerns where your business logic (calculations, database interactions etc.) should be clearly separated from the UI Logic (presentation layer)
Kubilay Oj
Related Q & A:
- What is the best data model and database systems to store social graph?Best solution by Quora
- How to call Controller from View?Best solution by Stack Overflow
- How to fetch data from web page?Best solution by Stack Overflow
- How to access the model from the controller in zend?Best solution by stackoverflow.com
- How to open a partial view from controller as a Jquery Mobile dialog?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.