开发者

Flex - implementing a MVC pattern without a framework, should httpservice be in the model or the controller?

开发者 https://www.devze.com 2023-03-17 05:53 出处:网络
I would like to implement the MVC pattern to an existing Flex project.I want to separate out the controllers and models from the views.They cur开发者_JS百科rently all live together in large mxml files

I would like to implement the MVC pattern to an existing Flex project. I want to separate out the controllers and models from the views. They cur开发者_JS百科rently all live together in large mxml files.

My question is, should httpservice requests be in the model or the controller? What sort of advantages/disadvantages would there be to either?


I normally try to abstract any service request into a Command call (execute, result, fault) which gets the service it needs to called injected in (which can be a good idea to abstract even more and be a service delegate).

There's a good example of how to use short lives command objects in Parsley's dev manual (one of the more popular frameworks).


I would rather approach the services as something totally different - an MVCS, not just MVC. You should check the Introduction to Flex Application's Architecture I wrote in my blog.


I looked at httpservice, and it seems to me that, while the service itself might reside in a repository or Service Layer (between the controller and the model), using the service involves references to UI elements such as DataGrid. So the implementation of that service probably would occur in the controller, or even in a ViewModel object.

0

精彩评论

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