Lambda the Ultimate

inactiveTopic C# interview / OOP in any language
started 4/5/2001; 12:09:52 AM - last post 4/6/2001; 7:12:56 AM
andrew cooke - C# interview / OOP in any language  blueArrow
4/5/2001; 12:09:52 AM (reads: 2123, responses: 6)
C# interview / OOP in any language
A bunch of vaguely related links:

  • Don't think we've covered this interview on C# before (contains links to further articles; as the dust settles is it fair to say .NET seems more important than C#?).

  • Brief argument against OOP in any language (refers to above article; doesn't make the (IMHO significant) distinction between implementing encapsulation (easy) and inheritance (hard))

  • A debate in French about the argument above (from the site that started me on this chain of links).


Posted to OOP by andrew cooke on 4/5/01; 12:14:32 AM

andrew cooke - Re: C# interview / OOP in any language  blueArrow
4/5/2001; 12:18:31 AM (reads: 1972, responses: 0)
Another link in those articles is this Advogato piece on why free software isn't in C++.

More on C#/.NET here.

John Lawter - Re: C# interview / OOP in any language  blueArrow
4/5/2001; 9:22:58 AM (reads: 1954, responses: 1)
...doesn't make the (IMHO significant) distinction between implementing encapsulation (easy) and inheritance (hard)

Forget inheritance. Try implementing message passing. Even many "OO" programming languages can't get that right !

andrew cooke - Re: C# interview / OOP in any language  blueArrow
4/5/2001; 9:37:26 AM (reads: 2012, responses: 0)
What is message passing? I guess that makes me sound really stupid (if I don't ask, I'll never learn, which is more stupid still), but although I've heard people mention it, I've never understood why it's special/different to calling a method (is this a Smalltalk thing? I'm afraid all my OO experience is Java with a smattering of C++, CLOS, and OCaml).

In other words: what do many "OO" languages do wrong? (Thanks!)

Oleg - Re: C# interview / OOP in any language  blueArrow
4/5/2001; 4:31:51 PM (reads: 1955, responses: 0)
> What do OO languages do wrong?

The set of pages http://pobox.com/~oleg/ftp/Computation/Subtyping/

shows that if a Bag and a Set considered _objects_, neither of them is a subtype of the other. One can certainly make a Set a subclass of a Bag, but doing so leads to very subtle problems. The page above demonstrates the problems in all the gory details. If a Bag and a Set are considered just _values_, without any intrinsic state or behavior, then Set _is_ a subtype of Bag. Every set is also a bag. The page above shows how easy things become, and how the subtle subclassing problems become simply impossible.

The pages show that OOP actually hinders the separation of interface from implementation rather than promotes it. If you ever subclass anything and (willingly or unwillingly) override an existing method you must examine the whole _implementation_ of the parent class(es) to see if the method to be overridden is used internally, and if it is, if your overriding is safe and proper. There exist principles of safe design (e.g., LSP), but they are generally undecidable -- and cannot be checked by a compiler.

Behavior overriding -- one of the planks of OOP -- is exceptionally troublesome. To me, it's better to just say NO.

Adam Vandenberg - Re: C# interview / OOP in any language  blueArrow
4/5/2001; 6:55:21 PM (reads: 1951, responses: 0)
A link on "What is LSP?": http://ootips.org/lsp.html Found this sometime last year when people were throwing around the acronym without defining it.

John Lawter - Re: C# interview / OOP in any language  blueArrow
4/6/2001; 7:12:56 AM (reads: 1987, responses: 0)
Message passing is a term most often associated with Smalltalk. A good paper to read would be The Smalltalk-76 Programming System Design and Implementation by Dan Ingalls. It describes how message passing worked in an early Smalltalk implementation, and gives a pretty good description of the overall language.

It doesn't make you sound stupid to ask. Unfortunately, many language designers did not ask this question, and *completely* missed the real point of object-oriented programming.

Message passing is extremely powerful. I've had to start programming in Java, after programming in Objective-C, and I *really* miss the latter's message passing and dynamic typing.