I've read a lot of trivial MVC examples of calculators and thermometers but I can't seem to map the pattern to real world applications.
Suppose you have a more complicated scenario. Say you have a website shopping cart which requires users to login before adding to the cart. First, the user sees the product page (/product/detail) and clicks on add an item (/cart/add/207366). The user is not logged-in yet so they need to visit the login page (/user/login) and then, being smart about the flow, takes them to the shopping cart view (/cart/list). From there, they can link back to the original product detail page to continue shopping.
Let's say we have 3 database tables: users, usercart, and products. What is/are the model(s) in this situation? Would this entire flow be encapsulated into the addProductToCartFlow function of the ShoppingCart model? That would seem to be a bit messy, since it would need to access the users table for login/authentication and access the products table for pulling the product details/price into the cart.
Instead, would you say the ShoppingCart model is SELF-CONTAINED and only deals with adding items, removing items, etc. from the cart? The "logic" of the user being logged-in would then be checked elsewhere: perhaps in the controller itself? This would make the controllers very BUSY with quite a bit of "business logic" such as checking if the user is logged-in, checking if the shopping cart is empty, etc. and the model just becomes a pretty name for the database table.
Or maybe, the very fact of being logged-in or logged-out is part of a UserAuthentication model that deals with such functions. Or maybe we need a UserPageState model to tell us whether the user should be on a login page, or a cart page, or a product detail page?
What is the best MVC design for this situation in your opinion?