MVC and command pattern

前端 未结 2 546
忘掉有多难
忘掉有多难 2021-02-10 10:27

Ok, this is kinda dumb. I\'m trying to wrap my head around the use of the MVC and Command Patterns. The questions basically concern where to place code.

In the MVC patte

2条回答
  •  一向
    一向 (楼主)
    2021-02-10 11:25

    To implement Command pattern in an MVC application depends on your specific need. Controller does not create any Command by default. If you need to implement command pattern in a MVC application you have to do it on your own.

    You can either implement the commands in the Controller or can do in a separate Service layer. It should not be in Model as Command pattern is behavioural and should be independent of model.

提交回复
热议问题