Perl, normally, has no interface specifications, strong typing, etc
We just have to try to get it right manually - which is not consistent
with laziness, niceness or hubris.
DbC shouldn't be that difficult in Perl. Just as Memoize is able
to slot itself between caller and function to provide cacheing, we can slot
tests in before/after a method executes.
Open Source software
- can be customized. Which is great.
- Even better if you can customize, then upgrade, and find it still works.
- Should have sensible interfaces, and preserve them (please!)
Caveats
- This is a brief overview only. There are other issues
(invariants, how tests are inherited) which have not been addressed.
- Class::Contract is "funky" (per its perldoc) and requires
a major rework of any class that it is applied to. Is anyone using it
in anger?
- "If DbC is so powerful, why isn't it used more widely? Does it make
you think about issues you'd rather ignore for now? Does it force you to
THINK?! Clearly this is a dangerous tool!" [Hunt/Thomas '00]
(Perhaps you should be thinking - about the task in hand?)
- A tight contract may simply pass the problem to the caller.