Web Client Software Factory (WCSF) - reusing views
By Steven Hillaert on Monday 27 July 2009, 10:34 - architecture - Permalink
This is a compilation of my comments on the blog of Simon Ince concerning reusing views in the WCSF framwork. If there are more comments posted I will also update this article. Please feel free to share your ideas as well.
First of all, if you don't know WCSF check out the
articles on Simon's blog, you can find my comments on
part 2 of his series.
comment 1 (me)
First of all thanks for the great articles about WCSF!
But I do have a question:
How do you achieve reusing a view (.aspx page) in a different page flow (process)?
It seems to me that this is impossible in WCSF. The view receives the presenter from the system and the presenter receives the controller but I don't see any possibility to decide which controller to use. I have the impression everything is hooked up in the wrong order to achieve reusing a view in an other page flow. In WCSF a user browses to a page and so it's actually the view that decides which process (page flow) is started. Would the ASP.net MVC framework be better suited for this?
Steven Hillaert
comment 2 (Simon)
@ Steven,
that's a good question. I think it applies equally to the MVC framework as the WCSF - remember the Controller in MVC is not an "Application Controller". Instead the MVC is similar to MVP, so in fact the question is how do we decide which Application Controller (or any page flow implementation) to use from within the Presenter (in MVP) or Controller (in MVC)? I find it curious that not many people have discussed using an Application Controller in MVC yet.
Anyway, the issue you're referring to is that in the WCSF most people inject a controller into the presenter using a [CreateNew] attribute... but you needn't do it that way if you don't want to. You could instead inject a ControllerFactory of some form, and use that to create a Controller based on further metadata available to the Presenter (perhaps some session data, or a querystring argument). You could also use a Service Locator approach instead of injection to achieve the same thing.
The other way that view reuse can be achieved is to create a User Control with an MVP trio... although how you compose these can be a complex subject so give it a try and see if it fits your approach.
Does that help?
Make sure you check out Blaine's post & survey here and feedback if this needs further guidance;
Simon
comment 3 (me)@ Simon,
Concerning WCSF:
During the weekend I came to the same conclusions as you on how to implement
this in WCSF. I think the the querystring is the most flexible and practical,
the only problem I see with this is that the page could be "injected" into a
different process (pageflow) quite easily, some security will be needed here.
An other issue is that the controller will have to implement an interface for
every step (view) of the process because the presenter might used several
controllers that don't necessarily have the same interface.
Concerning MVC:
I had a quick look at it (reading) and I would think that reusing a view is a
lot easier here. The controller in MVC is a front controller, the user actually
"surfs" to the controller and not directly to a view. So you can make the user
surf directly to a process and then the process (controller) decides which view
to load.
Thanks for your help Simon, I will definitely take the survey and give feedback concerning this topic.
Steven
UPDATE
My implementation of a possible
solution.









