Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Eiffel > Modular Protect...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 12 Topic 876 of 909
Post > Topic >>

Modular Protection vs Assertions ...

by bravegag <bravegag@[EMAIL PROTECTED] > Jul 28, 2007 at 06:40 AM

Hi all,

After reading Bertrand Meyer's OOSC book I find a little bit blurred
the line between using proper exception declarations in public methods
vs using asserts for precondition checking.

It is confusing to me the fact that:

- Bertrand remarks the need of "Modular Protection" which is not
clearly stated but I assume it also applies to Software-to-Software
communication i.e. between modules. Therefore module boundaries or
module public API must rely on proper exception handling for argument
checking and in general precondition checking (instead of using
assertions for that purpose). I find "Modular Protection" to be
somehow similar to "Defensive Programming".

- On the other hand Bertrand Meyer also remarks a valid thing which is
that excessive checking can be very harmful performance-wise.
Therefore recommends using assertions that are enabled only during
development, testing and debugging and disabled once the system is
delivered in production.

Another fact is that (somehow contrary to Bertrand Meyers view) Sun
assert usage guideline dictate that "Do not use assertions for
argument checking in public methods" see
http://java.sun.com/j2se/1.5.0/docs/guide/language/assert.html#usage

So I can only make the conclusion that:

- Assertions should be used even in public methods as long as those
methods are not part of the public API of a module i.e. assertions are
not an input checking mechanism for module boundaries. Bertrand Meyer
has a section in the chapter "Design by Contract" and the headline is
precisely that but then he remarks it is intended only for Human-to-
Software communication or Outside-World-to-Software communication.

- Proper exception handling should be the solution to use within
module boundaries so that not only the public API of a module
establishes a contract but also allows the client modules to
gracefully retry or at least recover from serious faults as
consequence of precondition violations in production time.

I would greatly appreciate your feedback or insights into this subject
or even pointers to further discussion.

I have seen situations where faults may lead to a total software chaos
just because they used assertions within module boundaries for input
checking rather than proper exception handling.

TIA,
Regards,
Giovanni




 12 Posts in Topic:
Modular Protection vs Assertions ...
bravegag <bravegag@[EM  2007-07-28 06:40:53 
Re: Modular Protection vs Assertions ...
Colin LeMahieu <clemah  2007-07-29 01:08:25 
Re: Modular Protection vs Assertions ...
llothar <llothar@[EMAI  2007-07-29 04:24:56 
Re: Modular Protection vs Assertions ...
Ulrich Windl <Ulrich.W  2007-07-31 08:59:00 
Re: Modular Protection vs Assertions ...
Ulrich Windl <Ulrich.W  2007-07-31 08:54:06 
Re: Modular Protection vs Assertions ...
llothar <llothar@[EMAI  2007-07-31 11:26:53 
Re: Modular Protection vs Assertions ...
bravegag <bravegag@[EM  2007-07-31 23:57:33 
Re: Modular Protection vs Assertions ...
bravegag <bravegag@[EM  2007-08-01 00:14:09 
Re: Modular Protection vs Assertions ...
Ulrich Windl <Ulrich.W  2007-08-02 10:47:43 
Re: Modular Protection vs Assertions ...
llothar <llothar@[EMAI  2007-08-01 01:39:38 
Re: Modular Protection vs Assertions ...
llothar <llothar@[EMAI  2007-08-01 01:42:00 
Re: Modular Protection vs Assertions ...
Colin LeMahieu <clemah  2007-08-01 07:27:23 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon May 12 2:43:16 CDT 2008.