Login

Objects

After its introduction OOP became very popular (I will explain why later) and criticising OOP was rather like "swearing in church". OOness became something that every respectable language just had to have.

As Erlang became popular we were often asked "Is Erlang OO" - well, of course the true answer was "No of course not" - but we didn’t to say this out loud - so we invented a series of ingenious ways of answering the question that were designed to give the impression that Erlang was (sort of) OO (If you waved your hands a lot) but not really (If you listened to what we actually said, and read the small print carefully).

At this point I am reminded of the keynote speech of the then boss of IBM in France who addressed the audience at the 7th IEEE Logic programming conference in Paris. IBM prolog had added a lot of OO extensions, when asked why he replied: "Our customers wanted OO prolog so we made OO prolog" I remember thinking "how simple, no qualms of conscience, no soul-searching, no asking "Is this the right thing to do"

- Joe Armstrong

Meanwhile, Xavior Leroy: Objects and classes vs. modules in Objective Caml (dropbox)

In particular,

Things that work better with modules

  1. Clear distinction between the values and the operations over them (better for n-ary operations)
  2. Stronger representation hiding
  3. Functors as a general parameterization mechanism
  4. Safety at the expense of flexibility

Things that work better with objects and classes

  1. Subtyping and row polymorphism at the level of values
  2. Incremental programming via inheritance (open recursion, default implementations that can be overriden later)
  3. Flexibility at the expense of safety