MVP (Model - View - Presenter) 中的 ICommand 实现是否属于 Presenter 或它自己的类?
1 回答
You are talking about a custom MVP setup correct? Not some form of framework?
My feeling is that any commands should be in their own class.
My reasoning for this comes from an experience I had where we built a win forms app using the MVP pattern. In this project we built a simple app and later needed to develop another application that contained almost all of the same functionality, plus more. So we re-used the model for the simpler app but did not re-use any of the presenters or views.
Commands being in their own class means that you can do something like the above and keep using the icommand implementations relatively easily.