开发者

Should you have multiple controllers in an AS3 MVC implementation? [closed]

开发者 https://www.devze.com 2023-03-29 23:23 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 11 years ago.

I am creating a very simple game in AS3 as an exercise in pure MVC. The application will have 3 views: a start/replay screen, a score/time display and the actual game area.

There is an obvious separation between the start screen and the other two elements that are active during game time, so should there be two controllers, one to handle game events and one for out-of-game events? Or is it bad practise to have multiple controllers in a very small application?

Maybe what I'm really trying to get at is: if you were r开发者_运维百科eviewing this game as a prospective employer, would you look badly on there being a different controller for the different states of the application, or would you appreciate the seperation?


I think it's quite subjective but I tend to use only one Controller even for large applications. In AS3 I separate every action in a class called by my Controller. Eventually the Controller only contains a large switch instanciating different action classes depending on the received event. I hope this is clear enough :)

0

精彩评论

暂无评论...
验证码 换一张
取 消