hesten
|
|
« on: June 29, 2009, 12:15:44 » |
|
Hi All I'm trying to get my head around PureMVC. I am doing it by refactoring a really simple app I've done. So I thought I would ask here if my initial approach is somewhat correct, or if I am misunderstanding certain concepts?
The app is a searchable gallery of products.
The product data is loaded from a server, and the images are also dynamically loaded.
The user can enter various criteria and the gallery is then updated to display only the products that fit the criteria.
The user can then click a product image to get more information on that product.
Thats it.
So I have 3 view components; UserSelectionUI (containing various buttons, a combobox and a search field) GalleryView ProductDisplayView (and maybe an AlertView for error messages)
These view components gets a Mediator each.
I have two proxies; ProductProxy (which loads the xml and stores the product list) ParamsProxy (for flashvars)
The ProductProxy is initiated from a StartUp Command, when the xml is loaded it is parsed into a list of ProductVO objects, which the proxy now stores. It then sends a notification that the data is ready. I am in doubt as to where I should put the filtering function that find product matches based on user input. Should it be in a Command or in the Proxy, or even in the UserSelectionUIMediator? Right now I’ve implemented the filtering function in a Command (SearchCommand). The notification for the search contains a SearchVO containing all the search settings (the properties the user has selected).
But this means that the view component (UserSelectionUI) needs to populate the SearchVO and pass that to the mediator who then ships it with a notification to the Command. That’s a lot of shared knowledge isn’t it?
The Command needs to compare the result list with the previous result list to prevent an unnecessary update of the view. Since Commands holds no state information I’m storing the previous result list in the ProductProxy, is that ok?
Are VO’s part of the model controller or view?
Hope this makes sense?
Regards
|