You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by "Gregor J. Rothfuss" <gr...@apache.org> on 2005/06/11 16:14:40 UTC
design by contract
i think we should have more code like this:
http://svn.apache.org/viewcvs.cgi/lenya/trunk/src/java/org/apache/lenya/xml/DocumentHelper.java?rev=180303&r1=169810&r2=180303&diff_format=h
if (document == null)
throw new IllegalArgumentException("illegal usage, parameter
document may not be null");
to enforce the API and make it easier to track down problems to the
source. as jwkaltz writes in his commit message, NPE are no fun to debug.
this style of programming is known as design by contract
http://c2.com/cgi/wiki?DesignByContract
while java is not eiffel, i still think we can achieve a lot of the
benefits by using IllegalArgumentException as widely as possible.
WDYT?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: design by contract
Posted by Andreas Hartmann <an...@apache.org>.
Gregor J. Rothfuss wrote:
[...]
> this style of programming is known as design by contract
>
> http://c2.com/cgi/wiki?DesignByContract
>
> while java is not eiffel, i still think we can achieve a lot of the
> benefits by using IllegalArgumentException as widely as possible.
>
> WDYT?
A wholehearted +1.
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org