From: Robert Dober Date: 2006-04-02T23:12:39+09:00 Subject: Re: Typed Parameters ------=_Part_3190_28007883.1143987155976 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 4/2/06, gwtmp01@mac.com wrote: > > > On Apr 2, 2006, at 9:29 AM, Austin Ziegler wrote: > > On 4/2/06, Robert Dober wrote: > >> My programs often pass objects of an unexpected "contract, behavior, > >> type, mixin interface" you name it. I would like a modern language to > >> help me, the *stupid* programmer to be more *effective* Ruby claims > >> that. > > > > It's called "unit tests." If your programs are often passing objects > > that don't behave the way you want those objects to behave, then > > it's a > > bug that you should be ensuring doesn't come out of the caller; in > > Ruby > > it's often far more efficient to ensure that the caller doesn't > > screw up > > instead of the callee doing checks ... > > If I remember correctly from _Object Oriented Software Engineering_, > Betrand Meyer specifically talks about how when pre-conditions fail, it > is the *caller* that has violated the contract. When a program is > written > correctly (i.e., without bugs) pre-condition testing is completely > superfluous > at run-time. I think the Eiffel compilers even have a switch to turn- > off > run-time pre-condition testing. > > I'd rather see the support for pre-conditions and testing within the > context of the development environment rather than burdening the run- > time > environment. The use of annotations along with smart text editors and > test-case generators might be useful. > > Gary Wright Interesting points, please be aware though, that the runtime environement would not be burdened at all. I was just talking about alternative syntax for things one can do already The Eifel idea is intriguing though. One could run with a switch to execute pre_condition assertions A have difficulties evaluating the role of "unit testing" in these conceptual idea of checking conditions. Maybe we should see programs incomplete without there test suits. As this strikes me as a sound approach not followed often enough it might not be possible all the time and is not really part of the Ruby concept. Cheers Robert -- Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_3190_28007883.1143987155976--