Arguments About Mvc And Simple Views.

Hi guys. You often read about “purists” saying that the View must be as simple as possible and detached from everything else, but I wonder if any of them has ever written a genuine complex report. :unsure:

I can totally understand that you want to keep your "final view rendered to the browser" as lean as possible. But in the process of getting there, I often have horrendous views calling many other - using multiple CListViews to tunnel through 4 or 5 tables.

You cannot always just tunnel through these tables using Relational Query in one model, because their criteria are often very complex and conditional. And some of them are complicated ‘tree’ tables that need to be tamed by large behaviors that need their own separate arguments.

All this code is not something that you "quickly do in the controller" or in any single model. However, the views being spit out by the different CListView widgets are "the perfect place in the flow of the process" to work on the "next required tables" - via their own models and behaviors.

Also, I don’t want to put this code in the controller because my controller is very generalized and dynamic - enabling me to re-use the same controller for all my models. (This saves tons of work - so changing this is not an option.)

So how do you keep your views lean in MVC?

Isn’t the final code “rendered” to the browser lean and simple - regardless of how many complicated views were used to render it?

Is that why MVVC has a separate view-model?

Any thoughts? Thanx.

I’ve run into this problem myself. For a client that has very specific reporting needs, sometimes it’s not practical to build a separate view for each report, but rather give the client’s options and dynamically create the queries and reports based on their selections. It seems anytime I need to use find(All)BySql, the resulting code winds up being pretty much a view with procedural code. This doesn’t happen often, but I’m interested to know of some best practices when dealing with bunches of dynamic queries and results.

Exactly my point too, Lacquer. Thanx.