From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,2c6139ce13be9980 X-Google-Attributes: gidfac41,public X-Google-Thread: f43e6,2c6139ce13be9980 X-Google-Attributes: gidf43e6,public X-Google-Thread: 1108a1,2c6139ce13be9980 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,3d3f20d31be1c33a X-Google-Attributes: gid103376,public From: Nick Leaton Subject: Re: Separation of IF and Imp: process issue? Date: 1997/09/10 Message-ID: <3416B6E0.25C2E5F0@calfp.co.uk>#1/1 X-Deja-AN: 271339020 X-NNTP-Posting-Host: calfp.demon.co.uk [158.152.70.168] References: <33E9ADE9.4709@flash.net> <5upe9k$7he@newshub.atmnet.net> <5utag9$o6s@newshub.atmnet.net> <3416ad14.0@news.uni-ulm.de> Reply-To: nickle@pauillac Newsgroups: comp.object,comp.software-eng,comp.lang.ada,comp.lang.eiffel Date: 1997-09-10T00:00:00+00:00 List-Id: Joerg Rodemann wrote: > > Darren New (dnew@zloty.fv.com) wrote: > > > On the other hand, Eiffel specs are (I think) more expressive and > > complete than Ada specs, including preconditions, postconditions, > > invariants, and so on, and these things get inherited in sufficiently > > complex ways that just looking at the spec on paper is unlikely to be > > particularly informative anyway. Hence, typing all the assertions etc in > > two separate files is going to be a nightmare. > > What about having pre- and postconditions in the spec file? At least for > predconditions this should be possible. Postconditions may depend on internal > and thus private class information, so there might be a problem. Realize also > that not everything from the Ada spec is repeated ind the body: type or task > declarations for instance. Reliance on the internal information in both pre and post conditions is not a good idea. For example, consider a stack implemented using an array. extend (push) could have a precondition. data.count < data.capacity This is not a good idea. It is much better to implement the assertions using features available in the spec. In this case require not empty Where empty is a boolean feature implemented as above. Advantages, its more abstract and you can change the implementation without having to change the pre or post conditions. Using implementation details in pre/post condition is an indication that your class is missing features. ... > I'd like to agree that --- if you fiddle around with large logical expressions > or something it may take some time until it's correct in both places. Again > I wonder if it would be easy to have those pre- and postconditions in a > spec file. Or are they often too dependent on class internals? If so how > can they describe a contract between a client who certainly should not know > anything about the private parts of the class? Well, just an idea... See above -- Nick Eiffel - Possibly the best language in the world - unless proven otherwise.