MVC: Why put the business logic in the model? What happens when I've multiple types of storage?
Posted
by
Steffen Winkler
on Programmers
See other posts from Programmers
or by Steffen Winkler
Published on 2012-11-21T07:39:15Z
Indexed on
2012/11/21
11:23 UTC
Read the original article
Hit count: 426
mvc
|business-logic
I always thought that the business logic has to be in the controller and that the controller, since it is the 'middle' part, stays static and that the model/view have to be capsuled via interfaces, that way you could change the business logic without affecting anything else, program multiple Models (one for each database/type of storage) and a dozens of views (for different platforms for example).
Now I read in this question that you should always put the business logic into the model and that the controller is deeply connected with the view.
To me, that doesn't really make sense and implies that each time I want to have the means of supporting another database/type of storage I've to rewrite my whole model including the business logic.
And if I want another view, I've to rewrite both the view and the controller.
May someone explain why that is or if I went wrong somewhere? Currently, that whole thing doesn't really make sense to me.
© Programmers or respective owner