Aug 18, 2009
I have to process about 20 POST-parameters, and I am not sure where to do that. I could define each as an argument of the method on the model, and pass them from the controller when the method is called. This would result in quite a bit of work and make the function call less readable, due to the number of arguments.
View 4 Replies
Or I could call the method on the model, and just directly access the parameters. Passing the parameters as arguments would give me more control over which parameters the function accesses, and the documentation would more self-explanatory. But if new parameters were added later on, they would have to be added to the end of the method call, as not to break every existing call. I imagine that this would become quite confusing if it happens a few times, as the arguments can't be logically grouped.
If I access the parameter in the model, no parameters have to be passed from the controller to the model, making the method call terser. But I have no control over the parameters that are accessed, as they can easily and without restrictions be added or removed. This would require greater discipline from the other developers, and I dislike to depend on that, because sooner or later someone is bound to "just (add|change|fix) this real quick".
I'm not sure which way to go. I tend to just do it all in the model, as this is faster to write, seems easier to maintain (no argument chaos) and conceptually fits better into my view of a model. On the other hand, I'm not sure my view of a model is correct, and if it will end in chaos if I depend on the other developers to always update the documentation after each change. So, what should I do?