oo question - mixing controller logic and business logic

后端 未结 4 2160
我寻月下人不归
我寻月下人不归 2021-01-05 15:40

I\'m not sure if I\'m using \"standard\" terms, but this is a basic OO question I\'m trying to resolve.

I\'m coding a windows form. I don\'t want logic in the form

4条回答
  •  一整个雨季
    2021-01-05 16:32

    No, I don't put business logic in controllers. I add an intermediate service layer that's injected into controllers. Let the service do the work. Controllers are for routing requests and marshaling responses.

    Putting the logic in a clean service layer is "service oriented", even if you aren't using web services or WSDL. It has the added benefit of still working if you decide to change controller/view technologies.

提交回复
热议问题