I'm developing a web app that has more separate modules. User can use one or
more of them. Each module consists of views, a controller and navigation
graph.
Some modules shoul share same views so there won't be any necessity for
creating same views for each module. Each view is controlled by a specific
controller. So if I would share the same view over different modules there
would be more controllers responsible for the same view. I have a dillema
how to do it? I could check for the controller class type that is currently
used and call apropriate calls, but I don't think this is the optimal
solution.
Any suggestions or things you've done.
Additional info.
My views are just containers for web user controls like navigation, toolbar
and specific content controls for easier development. Same content control
could result in different toolbar items. All navigation and toolbar items
are controlled by configuration file and programmatic additions.
Thanks in advance.
Robert
> Some modules shoul share same views so there won't be any necessity for
> creating same views for each module. Each view is controlled by a specific
> controller.
Have you gotten anywhere with this? This would not be how I would do
it. You need to think of the view and the controller as a cohesive
unit. I think it makes sense to create a separate controller class
for each view in the system. Then, after you see your system come
together a bit more, you can create a class hierarchy of controllers
if you find yourself implementing the same behavior in more than one
controller class. (Keep in mind that Data in the system is stored in
State, not by the controllers themselves. The controller should be
thought of as "behavior" not "data".)
For example, suppose I'm going to create a system with 2 views (View_A
and View_B). I would initially create a separate controller, one for
each view (Controller_A and Controller_B). In the course of
implementing the system, if you discover that there is some common
behavior that you need to share between Controller_A and Controller_B,
then create a common base class that both Controller_A and
Controller_B would inherit from.
If, in fact, you find that your design requires the same view to run
with more than one controller, then I would create an interface that
defines what the common behavior is between all the controllers that
the view will work with. In the view, I would then type-case the
Controller into the common interface, and all should be well.
Just a thought.
--steve
Robert Koritnik - 31 May 2004 15:37 GMT
Actually I did. I don't write a separate controller for each and every view,
but I have per navigationGraph controllers that inherit from one base
controller. Works great even when views are shared accross different
navigation graphs. All views have a property (that hides WebFormView's)
Controller that is of MY base controller type. So when called a certain
method within it, they always execute the correct inherited controller
implementation. Works so far so good.
But I did something else beside that. Right now I'm implementing something
that could be calles "stateless Views" that are ALWAYS displayed with
Response.Redirect. I have a special object on the UIPAB State that makes
this possible. But it's quite complicated. In general it has a
TransferObject, Actions and State objects for each view... So far so good...
;)

Signature
RobertK
{ Clever? No just smart. }
> > Some modules shoul share same views so there won't be any necessity for
> > creating same views for each module. Each view is controlled by a specific
[quoted text clipped - 27 lines]
>
> --steve