struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jthomp...@honda.co.nz
Subject Java edit method - design pattern? (O/T)
Date Sun, 03 Oct 2004 22:51:20 GMT





I'm working on an application API to be deployed with struts, and am
interested in how other developers are dealing with 'editing' methods, ie
methods that answer a question with a true/false value, but if false is
returned, you also want to know why.

for example, a credit card application may have a method 'boolean
allowCreditFor(int cashAmount)' which returns true if the amount requested
is ok, but false if not.
But what if you want to know why false is returned?

Using an Exception seems to be a pretty good fit, but doesn't seem to me to
be in keeping with its purpose (ie that an Exception should signal an
abnormal outcome that couldn't be handled locally).

Thanks for your thoughts,

John Thompson


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message