Re: A question about weak contract
- From: "Phlip" <phlipcpp@xxxxxxxxx>
- Date: Sat, 24 Sep 2005 15:14:59 GMT
Tony Johansson wrote:
> I'm reading a paper from a university and it says.
>
> System boundary classes need weak contracts.
> - The user might not be trustable.
> * End-users do not accept that they have to test before a function
> call,
> which calls for weak contract.
>
> Now to my question why do we have to use weak contract here as was said.
> Why is it not possible to use strong contract in that situation?
Because the user might not be trustable.
Put it like this: "weak contract" means "strong defenses". Question every
input variable, and bubble up a clear error message if it's wrong.
"Strong contract" means "weak defenses". You migrate all the checks to this
virtual contract, and don't express them in code. When the contract
obviously fails, you write an error message to a log, and rely on
programmers to strengthen the other modules' adherence to the contract.
--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
.
- References:
- A question about weak contract
- From: Tony Johansson
- A question about weak contract
- Prev by Date: A question about weak contract
- Next by Date: Re: Where Does File System Singleton Go?
- Previous by thread: A question about weak contract
- Next by thread: Re: A question about weak contract
- Index(es):
Relevant Pages
|