How Does MVC Handle Missing Data Requirements

Posted by Don Bakke on Stack Overflow See other posts from Stack Overflow or by Don Bakke
Published on 2010-04-19T01:04:28Z Indexed on 2010/04/19 1:13 UTC
Read the original article Hit count: 313

Filed under:
|

I'm teaching myself MVC concepts in hopes of applying them to a non-OO/procedural development environment. I am pretty sure I understand simple View -> Request -> Controller -> Request -> Model -> Response -> Controller -> Response -> View flow.

What I am struggling with is understanding more complex scenarios. For instance, let's say I have a shopping cart form with a button for 'Calculate Shipping'. Normally a click on this button will follow the above flow. But what if there is missing data, like the zip code? Should the View verify this first and alert the user before making a 'Calculate Shipping' request? Or should the request be made and the Model returns a notification that critical data is missing? If the latter, does the Controller instruct the View to alert the user? What if I wanted to prompt the user for the missing zip code (perhaps in a popup input display) and then automatically request the 'Calculate Shipping' method again?

I suppose this gets into the question of how smart a View ought to be. It seems that MVC has evolved due to richer UI and automation (such as with data-binding) and this muddies the water from a purist MVC perspective. Any thoughts are greatly appreciated.

© Stack Overflow or respective owner

Related posts about mvc

Related posts about flow