I’m afraid it is YOU who is inferring too much from the arrows in that diagram. The MVC pattern requires at least three components, the Model, the View and the Controller, each of which has its own specific responsibilities. The same data can flow between each of these components and is processed differently within each. HOW the data flows, whether it is pushed or pulled, or who does the pushing or pulling, is NOT specifed in the pattern. That is an implementation detail.
No I’m not. There’s no data flow in that diagram, so it simply won’t work.
It is quite clear that you do not understand the difference between DATA and LOGIC.
DATA is just a collection of variables which may hold different values at different moments in time.
LOGIC is the program code which acts upon, manipulates or transforms that data in some way.
Thus in a web application the “display logic” is that code which transforms that data into HTML. The fact that some or all of that data has also passed through other components does NOT mean that those other components also contain “display logic”. They share data, yes, but not logic.
In a database application the Model may use a separate Data Access Object (DAO) in order to communicate with the database. This is where the data is transformed into SQL, or where and SQL statement provides data.
So you see, the same data can pass through the Controller, the Model, the DAO and the View, but this does NOT mean that all the components share the same logic. The data access logic (program code) to transform the data to/from SQL exists ONLY in the DAO, not anywhere else. The display logic (program code) which transforms that data into HTML exists ONLY within the View, not anywhere else.
Again you are inferring too much by the arrows in the diagram. The data flows from the Model to the View, but it does not matter whether that data is pushed by the Model or pulled by the View. The mechanics of how the flow is actually performed are irrelevant as they are an implementation detail.
Wrong. The Model does not work out how many records or pages there are. These are variables which are determined immediately after the sql SELECT statement has been issued within the DAO. These variables are then passed through the Model to the View so that they can be displayed (or not) in some way. The fact that the DAO contains data that is transformed in the View most certanly does NOT mean that the DAO contains “display logic”. It is data, not logic.
I do not tailor each of my table classes so that it only contains the variables which the current View actually needs. This “tailoring” would create an enormous programming overhead which I personally would find unacceptable. Instead each table class creates whatever variables are appropriate to the current operation, then it hands ALL those variables to the View for transformation into HTML. How the View deals with those variables is of no concern to the Model.
If you bothered to read what I wrote you will see that I have already achieved that within my framework. Any table class (Model) can be used, without modfication, by any Controller and any View.
I disagree. It is not the View’s responsibility to filter out records, or to sort those records into a particular order. After the records are transferred from the Model to the View it is the View’s repsonsibility to display all of those records in the order in which they were given.
Not in my opinion. It is far more efficient, and requires less code, to have the data sorted within the sql SELECT statement. The fields may come from the database in a totally random order, but the View can position each of those fields wherever it likes. I don’t have to change the sql statement in order to change the order of fields on the screen.
This control should be limited to where and how each field is displayed, but NOT which records should or should not be displayed, or the order in which they are displayed. The choice of which records to display, and their order, has already been determined by the Model/DAO.