ScottGu posted Part 1 of a series about ASP.NET MVC.  One of the comments asked, "How is input validation going to work?"  That's something that I've been wondering about as well.  With the ASP.NET MVC framework, and others it seems, if the controller has no reference to the view, how does the controller tell the view that the first name field is required?  How does the controller tell the view that the phone number field must be a valid US phone number?  Moreover, how does the controller enforce field-level security, or anything else that would require fine-grained control over the view.  After all, it is called a "controller."

All of this has me wondering what MVC purists would think of the Extended MVP Pattern that I developed.  To me, it seems to follow the MVP principles that Martin Fowler discusses, disallowing the view from having any knowledge of the model, but maybe my pattern allows the presenter to know too much about the view.  In my implementation, the presenter actually has a reference to the view and can manipulate it directly.  But, the presenter has no idea what the view actually looks like, it's merely working against a contract/interface for it.

I have some ideas on how my pattern would plug into the ASP.NET MVC framework, but the code wouldn't be very elegant.  If the controller had a reference to the view, it would seem much cleaner to me; but based on what folks were saying during ScottGu's talk where he introduced the MVC framework, the controller's knowledge that the view even exists seems to be a no-no in the eyes of many.

Technorati Tags: , , , ,