Consider the following scenario:
Page written in classic ASP or PHP, which is rendering a data report (series of HTML tables for simplicity). There is one main database query and then multiple sub queries as the page renders. The report is split into sub panels, which correlate to a sub query. Therefore:
- Main database query.
- Loop over result.
- For each row, execute sub query and render report panel.
How would you architect a similar report using the MVC pattern?
This can be split into two parts:
- Efficiency at database level of multiple queries, which are dependent on values from an outer query.
- If all data was processed and prepared in the controller, would this also be deemed inefficient if looping within the controller and then again in a view to render. Could sub controllers be used or sub panels, which encapsulate smaller sections of logic i.e. loading data and rendering report panel.
Appreciate this may look a bit vague but I'm interested in how you would approach the solution.