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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2ff5c149712ec0eb X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!k79g2000hse.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Ada Interfaces and the Liskov Substitution Principle Date: 25 May 2007 13:27:47 -0700 Organization: http://groups.google.com Message-ID: <1180124867.710641.176330@k79g2000hse.googlegroups.com> References: <1179953657.839272.160320@a26g2000pre.googlegroups.com> <1179991769.376381.252010@m36g2000hse.googlegroups.com> <12h6mi42jcha0.7f9vfsnihjwr$.dlg@40tude.net> <1180011507.159515.46920@o5g2000hsb.googlegroups.com> <1180079541.558215.256570@h2g2000hsg.googlegroups.com> NNTP-Posting-Host: 85.3.214.254 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1180124868 15113 127.0.0.1 (25 May 2007 20:27:48 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 25 May 2007 20:27:48 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: k79g2000hse.googlegroups.com; posting-host=85.3.214.254; posting-account=Ch8E9Q0AAAA7lJxCsphg7hBNIsMsP4AE Xref: g2news1.google.com comp.lang.ada:15937 Date: 2007-05-25T13:27:47-07:00 List-Id: On 25 Maj, 10:21, "Dmitry A. Kazakov" wrote: > > Interesting. In most of the cases, the factory function creates the > > object of whatever type *it* decides (based on its parameters or some > > other input values) and initializes the class-wide type accordingly. > > Not necessarily. In one case, I generate nodes of a graph. The nodes can be > of different types regarding their persistence. For example, there are > nodes resident in the database and nodes resident in the memory etc. Now, > when creating a new node a factory moves along two axes: the standard > root/branch/leaf hierarchy and persistence stuff. For the latter the > factory receives an already existing node, to create "a new node like > this." This is not copying. Ideally it should double dispatching along both > axes. I have implemented it as: > > New_Node := Create (Get_Factory (Some_Existing_Node), ...); Above, it is the factory function that is "parameterized" on the left- hand type - this is still much different from assignment_statement (wow!) between two class-wide types. I'm still for banning it. > > There is a very simple rule of thumb for checking whether any given OO > > pattern makes sense - try to stick it to the classical geometry > > example. > > If it falls off, beware. :-) > > You certainly mean the circle-ellipse LSP controversy... (:-)) Ontological relationships have nothing to do with behavioral substitutability. There is no controversy there, only confusion. ;-) -- Maciej Sobczak http://www.msobczak.com/