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,f66d11aeda114c52 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,f66d11aeda114c52 X-Google-Attributes: gid103376,public From: nospam@thanks.com.au (Don Harrison) Subject: Re: Design By Contract Date: 1997/09/02 Message-ID: #1/1 X-Deja-AN: 269444607 Sender: news@syd.csa.com.au References: Reply-To: nospam@thanks.com.au X-Nntp-Posting-Host: dev50 Organization: CSC Australia, Sydney Newsgroups: comp.lang.ada,comp.lang.eiffel Date: 1997-09-02T00:00:00+00:00 List-Id: Jon S Anthony wrote: :In article nospam@thanks.com.au (Don Harrison) writes: : :> :Isn't that exactly the point? Why should a client be able to see the :> :actual structure, aka implementation???? :> :> No, the point is that there is no need to hide the structure of an attribute :> so long as it's read-only (look-but-don't-touch). These semantics allow you :> to query components of visible objects directly: : :I'm not convinced that is sufficient. Knowing the structure can lead :one into writing things that still depend on it (efficiency hacks come :quickly to mind). The thing is, though, that the designer of the supplier class *intends* the client to see the structure of attributes in just the same way as the author of an Ada interface *intends* clients to see the structure of a value returned by a function. Exporting happens on a need-to-know basis. If clients need attributes for any purpose (including efficiency tuning), then the supplier exports them. If they don't, then the supplier keeps them hidden. Note that in the extreme case of an attribute whose underlying class exports none of its attributes, you have the equivalent to an Ada private attribute. That is, the Ada package Some_Module is type My_type is tagged private; ... -- exported operations No_structure : My_type; private type My_type is tagged record ... -- hidden attributes end record; end; is roughly equivalent to the Eiffel class MY_CLASS feature ... -- exported operations feature {NONE} ... -- hidden attributes end class SOME_CLASS feature no_structure : MY_CLASS end So, if a supplier really needs to restrict what clients can see, for whatever reason, they're able to. However, the good thing about Eiffel is that it gives designers the flexibility of exposing as much or as little of an object's structure, in contrast with with Ada's you-see-it-all or you-see-nothing export policy. Don. (Reverse to reply) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Don Harrison au.com.csa.syd@donh