In MVC/MVP/MVPC where do you put your business logic

model-view-controllermvppuremvc

in the MVC/MVP/MVPC design pattern where do you put your business logic? No, I do not mean the ASP.NET MVC Framework (aka "Tag Soup").

Some people say you should put it in the "Controller" in MVC/MVPC or "Presenter". But, others think it should be part of the Model.

What do you think and why?

Best Answer

This is how I see it:

The controller is for application logic; logic which is specific to how your application wants to interact with the domain of knowledge it pertains to.

The model is for logic that is independent of the application. i.e. logic that is valid in all possible applications of the domain of knowledge it pertains to.

Hence nearly all business rules will be in the model.

I find a useful question to ask myself when I need to decide where to put some logic is "is this always true, or just for the part of the application I am currently coding?"