Talk:Schizophrenia (object-oriented programming)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Delegation and inheritance[edit]

The article uses a single reference to support the statement that delegation is inheritance "...some programming languages use delegation, which is semantically equivalent.", but then confuses the reader by describing how the semantics of delegation and inheritance differ (which is, ironically, the point of the whole article.

C2's page on this topic gives a more balanced discussion, including:

  • a link to at least one paper that refutes Stein's opinion.
  • a discussion of different viewpoints as to what delegation is.

The paper which is used as a counterexample to Stein's OOPSLA '87 paper is: "Automated Delegation is a Viable Alternative to Multiple Inheritance in Class Based Languages" [Viega, Reynolds and Behrends] http://www.cs.virginia.edu/~evans/cs655-S00/readings/viega.pdf

--

To be clear, what Stein's paper says is that delegation among prototypes is the same mechanism as inheritance among classes (NOT instances). This is spelled out more clearly in Lynn Andrea Stein, Henry Liberman, David Ungar: A shared view of sharing: The Treaty of Orlando. In: Won Kim, Frederick H. Lochovsky (Eds.): Object-Oriented Concepts, Databases, and Applications ACM Press, New York 1989, ch. 3, pp. 31-48 ISBN 0-201-14410-7 (online at Citeseer)

Stein's original paper does not say that the relationship among instances in a class-based language is the same as delegation (the relationship among certain instances in a prototype-based language such as self). Stein's paper is a refutation of Lieberman's claim that delegation is more powerful than (class-based) inheritance, NOT a claim that class-based and prototype-based instance relationships are the same. The Viega et al. paper does not refute Stein's central result; it explicitly reiterates it.

(The Lieberman paper claiming that delegation is more powerful than (class-based) inheritance is Henry Lieberman: Using prototypical objects to implement shared behavior in object-oriented systems. In: Conference proceedings on Object-oriented programming systems, languages and applications. Portland 1986, p. 214-223 ISSN 0362-1340 (Online at MIT Labs)) — Preceding unsigned comment added by 96.237.189.238 (talk) 02:07, 26 September 2011 (UTC)[reply]

I've removed the claim tagged as dubious. Diego (talk) 22:49, 12 March 2014 (UTC)[reply]

Please supply a simple example of schizophrenia (object-oriented programming)?[edit]

  • @Nbarth and Jcoplien: This article says "Object schizophrenia or self schizophrenia is a complication arising from delegation and related techniques in object-oriented programming, where "self"/"this" can refer to more than one object.". Sometimes I have found in email conversations, where an email message contains quotations nested several deep of messages that other messages were in reply to, making it unclear what the pronouns "I"/"me" and "you" refer to, is this an example of "object schizophrenia" (Sometimes to avoid this lack of clarity, I have resorted to referring to myself and the intended reader of the message in the third person by using names instead of pronouns.)
    • It may happen that some authority passes laws ordering that "All students must do XXXXX" and "All married people must do "YYYYY"", but, if the same person cannot do both XXXXX and YYYYY at the same time, it does not order what a married student should do. Is this an example of object schizophrenia? Anthony Appleyard (talk) 11:19, 14 January 2020 (UTC)[reply]
  • @Anthony Appleyard: No, neither is an example of object schizophrenia. Object schizophrenia is a very specific issue in object-oriented programming, due to the general issue of ambiguity (in this case, ambiguity of this or self). Your first example is just ambiguity of pronouns, while your second is just overlapping laws.
—Nils von Barth (nbarth) (talk) 08:22, 17 January 2020 (UTC)[reply]
  • @Nbarth and Jcoplien: Thanks, sorry. But it would be useful if you or someone could give a simple specific example of object schizophrenia. Thanks. Anthony Appleyard (talk) 15:26, 17 January 2020 (UTC)[reply]