G
Giovanni Azua
Hi all,
I am developing a framework in Java and facing the question of whether:
- Provide a defensive layer around my framework as part of the API public
contract e.g. throws IllegalArgumentException on invalid input or
"precondition violations".
Pros)
Cons)
- Do not provide any defensive layers but instead use assertions, so users
of my framework have the following options:
a) enable assertions during testing and debugging.
b) disable assertions once in production mode at the cost of
possible production faults because of unrecoverable
"precondition violations" that could lead to infite recursions
or the like.
Pros)
Cons)
I posted a thread "Modular Protection vs Assertions" in the following
newsgroup where I include different views on the subject from either Sun
guideliness on assert usage vs guideliness proposed by top figure in OO
Prof. Dr. Bertrand Meyer see:
http://groups.google.com/group/comp...6fbf9cd89c5/273571d8d33088a1#273571d8d33088a1
Any insights?
Which solution would YOU prefer if you were to be the user of a framework?
Best regards,
Giovanni
I am developing a framework in Java and facing the question of whether:
- Provide a defensive layer around my framework as part of the API public
contract e.g. throws IllegalArgumentException on invalid input or
"precondition violations".
Pros)
> Clear client-provider contract.
> Allows possible recovery in production mode.
Cons)
> Performance
- Do not provide any defensive layers but instead use assertions, so users
of my framework have the following options:
a) enable assertions during testing and debugging.
b) disable assertions once in production mode at the cost of
possible production faults because of unrecoverable
"precondition violations" that could lead to infite recursions
or the like.
Pros)
> Performance.
Cons)
production mode.> Preconditions are not part of the public interface contract.
> No chance to recover from precondition violations in
I posted a thread "Modular Protection vs Assertions" in the following
newsgroup where I include different views on the subject from either Sun
guideliness on assert usage vs guideliness proposed by top figure in OO
Prof. Dr. Bertrand Meyer see:
http://groups.google.com/group/comp...6fbf9cd89c5/273571d8d33088a1#273571d8d33088a1
Any insights?
Which solution would YOU prefer if you were to be the user of a framework?
Best regards,
Giovanni