Doubt - MVC system view

Asked

Viewed 68 times

0

I am developing a system for accounting in PHP, Mysql, jQuery and css, the system is divided into sectors, and each sector has a graphics tab (plugin highcharts), which are generated dynamically according to the parameters passed.

It works as follows:

indexView() -> renderIndex() -> calls menu and options ( suppose here that we enter the tax sector):

fiscalControll -> fiscalView() -> renderFiscal() -> calls the options of the tax and displays the Dashboard (now suppose we click on the tab 'Graphics'):

The system calls:

fiscalControll-> fiscalModel() -> get_charts_data_json_from_mysql($Chart).

in the sequence Controll takes the data of fiscalModel() and passes to fiscalView() rederize somehow, there is my 'problem'.

Doubt:

Should I render the graphics directly by the php function, or in a separate html page with the locations of the graphics?

Note: The two forms work, almost with the same response time, but which would be the most correct?

1 answer

1


Just paraphrasing the concept of View:

View: responsible for all processing required for display, including object processing and rendering.

The MVC has as its main focus the View. So all the other layers (MC) work almost exclusively for the View. However, processing/rendering is the sole responsibility of View.

If any object handling is performed by any other layer, with the sole purpose of rendering, move this logic to the View.

The only counterpoints I can add, is when the object is too complex and the View would only use a small part of it. In this case, the object can be treated earlier. However, usually some pattern such as Proxy/LazyLoad, does that job for you.

As a complementary reading, I suggest the following links:

https://forum.imasters.com.br/topic/536201-mvc-p%C3%A1ginas-din%C3%A2micas/#comment-2141430

https://forum.imasters.com.br/topic/557523-d%C3%Bavida-sobre-mvc-view/? do=findComment&comment=2224178

Browser other questions tagged

You are not signed in. Login or sign up in order to post.