Re: Design Question for Model and View
Jason Cavett wrote:
One last question - a controller doesn't necessarily have to be a
separate class, does it? Can it be part of (from a class perspective
- not a logical one) the model or view - especially if it doesn't do a
You should be more precise in terminology. Let me rephrase your question; you
tell me if I did it wrong: "Does one need to implement the controller in a
separate component from the view or model?"
The "controller" is a concept. As such, it is distinct from the "model" and
"view" irrespective of implementation.
many of the links at the bottom of that page address your specific questions.
Google on "model-view-controller". There are many variants on the theme.
One, whose name escapes me and I just plain don't feel like doing all the
googling here, represents fractally more detailed controllers each with its
own mini- (micro-, pico-, femto-, ...) MVC loop.
Marty Hall  suggests implementing the controller as a distinct method in a
backing bean, if you're programming for JSF . Other parts of the bean
implement the model, or part of it. I've done that; I've also implemented
controller functionality in a separate class, or even several separate
classes, using JSF.
Struts  uses a separate controller servlet that the application programmer
treats as a black box. Each Action class in Struts implements a method such
as execute() to handle the action for a screen. That method is the controller
for that screen. Or is it the logic? It's a floor wax /and/ a delicious