On Wed, 13 Aug 2003, Joe Germuska wrote:

> Date: Wed, 13 Aug 2003 22:01:30 -0500
> From: Joe Germuska <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: Struts Developers List <[EMAIL PROTECTED]>
> Subject: RE: ActionForwards, et al (was SuccessAction)
>
> At 9:07 PM -0400 8/12/03, Byrne, Steven wrote:
> >I guess I have to reiterate what others have said earlier today: how do
> >you deal with handling or enforcing composition order?  I.e. are you
> >implicitly assuming/requiring that the various elements in the chain are
> >orthogonal with respect to changes in the input/output "stream" or
> >changes in state that other elements in the chain might have visibility
> >into?  Or do you assume that the composition order is part of the
> >interface specification, document accordingly, and hope that your
> >clients will read and follow the ordering specification?
>
> Ted H more or less suggested this, but I think the way to go is to
> give each command an opportunity to validate any contract
> pre-conditions, like expecting certain beans to be defined in the
> context.  You could even just leave this up to the command author to
> do in the main execute method, but it might promote good practice if
> it were explicitly in the API.
>

How would you suggest putting something like this into the API?  Adding a
method like verifyPreconditions() seems like it makes things harder
instead of easier -- why not just let the execute() method throw an
IllegalStateException (or something like that) if its preconditions are
not met?

Such a policy is easily unit testable as well.

> Joe

Craig


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

Reply via email to