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 > Re: Modular Pro...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 12 Topic 876 of 913
Post > Topic >>

Re: Modular Protection vs Assertions ...

by bravegag <bravegag@[EMAIL PROTECTED] > Jul 31, 2007 at 11:57 PM

Hi Colin,

Many thanks for your feedback.

On Jul 29, 10:08 am, Colin LeMahieu <clemah...@[EMAIL PROTECTED]
> wrote:
> Exceptions are used to handle cases where the failure result could not
> have been predicted beforehand.  A network communications failure
> cannot be tested for and you can only observe its occurrence once it
> has happened.
>
You have somehow mentioned it in this paragraph which is my point
about module boundaries.

Suppose you develop a new Socket library API. You can and will test
all invalid cases that you could foresee as invalid uses of your
library. Optimally you would offer an extensive test-coverage and
examples of use of the library. Still your library as a separate
module DOES NOT know by whom and how it is going to be used in the
future. It is a reusable class library API right? so future and
unknown clients of this library:

- Must not know the library guts to be able to use it, which is the
case when they while using it start receiving any kind of assertion
violations from deep in the library code. There should be a defensive
layer around i.e. what Bertrand calls filter modules that ensure the
input is valid in the first place. But the reaction to invalid input
are Exceptions not assertions.

- Have the ability to recover at runtime from violations of the filter
modules otherwise unknown clients will not have any chance to recover
from filter module invalid input violations.

I personally would have a very bad feeling delivering such a reusable
class library
API (what I call module) to clients knowing they:

- Will have to test and debug my library finding out assetion
violations deep in my code rather that knowing upfront all invalid
input situations via exception in the module boundaries "throws"
declarations in Java.

- Will not have any chance to recover from possible assertion
(preconditions) violations which are not clearly stated in the
publicly visible API interfaces.

Many thanks for the interesting discussion.

Best 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 Fri May 16 10:48:56 CDT 2008.