[ potentially controversial topic ]
Hi all,
I have noticed that most of my Struts applications end up being
implemented like dismembered objects.

I design the controller parts of my Struts applications using
object-oriented design techniques, but then I have to transform my
designs into an awkward, non-object-oriented form:

* What was originally encapsulated object state has to be extracted
 and isolated as ActionForms.

* What were originally methods that acted on encapsulated object state
 have to become stateless processors in the form of Actions.

* The Struts servlet acts like another method-turned-C-function when
 it resets and assigns property-values in the ActionForms.

I can translate in the other direction too.  If I take someone else's
Struts application, I can derive an effective object model from the
relationships between the Actions and ActionForms described in the
struts-config.xml file.  That's really useful for figuring out what's
going on.

There's no problem getting all of this to work, and the Struts servlet
and framework do some very useful things.  But the separation of the
Actions from the ActionForms makes it harder to maintain the integrity
of the original object-oriented designs.

What I'd really like to see is a truly object-oriented approach to the
controller, where the state of the web-application is encapsulated as
instances of real classes (not just the equivalent of C struts) that
are acted on by methods.  The methods would be invoked just like
Actions are currently invoked, but rather than pass behavior-less data
to data-less functions, we could have methods acting on encapsulated
object state.  Who knows - maybe someday we could even have subclasses
and inheritance and constructors and methods with method parameters.

If action-mappings could map to methods invoked on named instances,
Actions and ActionForms could be merged into real objects, and the
object-oriented character of controller designs could be maintained.

Is there any compelling reason that this shouldn't be done?


I can get the object-oriented behavior I want using JPlates, but I don't want to have to duplicate all of the other contributions that Struts offers for web-applications. I use JPlates with Struts, but I'd be happier with a more object-oriented version of Struts.

Dan Jacobs
JPlates Inc.
http://www.jplates.com




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to