tags:

views:

121

answers:

3

Hello all,

Quiet a few times i have read this issue and still i was not able to find it exactly. Does the business logic falls into Model or in the controller in MVC Pattern?

Thanks

A: 

If you have a proper Domain Model, that actually is your business logic. Otherwise, you tend to put "services" (that is, classes that do perform business logic using your domain objects as input) somewhere else entirely. Best in their own project/assembly to make unit testing easier.

Neil Barnwell
A: 

If you are just choosing from M V or C, (without any subtleties of architecture) the then it's in M for sure.

UpTheCreek
+1  A: 

Roughly, yes.

The model normally is your Business Layer or your Domain Model. Sometimes, depending on the specific project, it may also be a special facade on top of the Business layer/domain model.

It may help to see MVC as a three-part component technique to loosely couple a UI to the core of the software, where the M, The V and the C are three different roles:

V(iew): the UI

M(odel): (mostly) the Business Logic/Domain Model itself; or everything else that represents it for the UI

C(ontroller): The component that mediates and coordinates the View/Model interaction, the only component that must know about both the View and the Model.

HTH!

Thomas Weller