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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,c52c30d32b866eae X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,2ea02452876a15e1 X-Google-Attributes: gid103376,public X-Google-Thread: 1108a1,c52c30d32b866eae X-Google-Attributes: gid1108a1,public From: Jacob Gore Subject: Re: Real OO Date: 1996/03/28 Message-ID: <4jf54u$o14@Sahara.enmu.edu>#1/1 X-Deja-AN: 144757209 distribution: world references: <4jbmsk$uo5@watnews1.watson.ibm.com> organization: Eastern New Mexico University newsgroups: comp.lang.ada,comp.lang.eiffel,comp.object Date: 1996-03-28T00:00:00+00:00 List-Id: Norman H. Cohen writes > No flexibility is being traded off. Your phrase "optimzation by the > developer" conjures up images of programs made inflexible and inscrutable > to improve efficiency, but that is not required with the Ada mechanism. Inflexible and insrcutable are not necessarily related. > All that is required is that, in a context where Rect1 and Rect2 are > known to both have dynamic type Rectangle_Type, Rect1 and Rect2 should be > declared to be of type Rectangle_Type rather than Shape_Type'Class. Then > the call Corresponding_Parts_Equal(Rect1, Rect2) is resolved statically > rather than dynamically. If anything, this increases the > understandability of the code. The question is not whether it is better to use Rectangle_Type instead of Shape_Type'Class, but whether it is better to use Rectangle_Type'Class instead of Rectangle_Type. Static resolution makes it impossible to safely attach a more specific rectangle object to Rect1 or Rect2, so you do sacrifice flexibility. Why decide in advance that your code, when inherited by a subclass, will ignore that subclass' redefinitions of some (or all) of the routines? It is hard enough to write classes that can be easily refined through inheritance (which ability is one of O-O's most advertized selling points) with dynamic binding; static binding makes it that much harder. Jacob --- Jacob Gore, Eastern NM U. Jacob.Gore@ENMU.Edu | Jacob@ToolCASE.Com [comp.lang.eiffel readers will have seen this message before; sorry about that -- Jacob]