[plt-scheme] OOP as a gateway to FP.

From: R. Clayton (rclayton at monmouth.edu)
Date: Tue Mar 22 14:04:23 EST 2005

  I claim that if OOP were taught properly, i.e., according to the standards of
  Smalltalk, moving from OOP to FP wouldn't be too difficult either.

Here's the experience that leads me to deny your claim: write a simple tbl-like
formatter to keep columns nicely lined up as the column-element widths vary.
After three go-arounds, my Smalltalk solution is still disgusting, while my
Guile solution (written between the first and second Smalltalk go-around) was
neat and clean and completely uninfluenced by my Smalltalk solution (however,
the Guile solution did influence the following Smalltalk solutions, which is
partially why they're still disgusting).

In my view, functional programming has the power of thin and flexible (and
sharp) interfaces, comprising a pleasant semantics, first-class higher-order
functions, pattern matching and such like.  Object-oriented implementations,
however, have thick and clumsy interfaces (at least with respect to clients;
the parent-child interface is another, but no better, matter) and the only
semantically useful idea - subtype polymorphism - is compromised by other
semantically dubious features (such as inheritance), as is illustrated by, for
example, the fragile base-class problem and its various solutions.

I interpret your claim as being analogous to claiming that the best way to
train surgeons is to start them off in boxing gloves.  Although I'm willing to
grant that it might be true, I'm even more willing to grant that the odds are
running heavily in the other direction.



Posted on the users mailing list.