Welcome Guest, Not a member yet? Register   Sign In
Is it okay/advisable to use input methods directly in models?
#4

[eluser]techgnome[/eluser]
I'd say it's a matter of debate. How ever, it's my preference as well to get the values from the post in the controller and pass them in an array (that way if you add/remove items, you don't need to change parameters to match) or through parameters. In MVC in its purest form, the model doesn't care where its inputs come from, it just receives input from the controller. Meanwhile, the view shouldn't care where its data came from either. The controller sits in the middle acting as traffic control.

That said, in the end, it doesn't matter, depending on how much you care about maintaining the level of separation between the different layers.

On the other hand, if you remove or add an element to the form being POSTed, you'll surely be making changes to your model (to either stop storing it, or start storing it)... which means also a change to the controller (since it will either exist or not as part of the post data) ... resulting three changes. The argument could be made that by getting the POST data in the model, you reduce your changes to the form and the model and the controller doesn't care.

Meh.

-tg


Messages In This Thread
Is it okay/advisable to use input methods directly in models? - by El Forum - 10-19-2010, 03:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB