Eppur si sugat

Joe Armstrong joe@REDACTED
Tue May 27 10:40:00 CEST 2003

   Eppur si sugat (was that right?)

   Hi Chris,

   Now I shall have to write a rebuttal to your rebuttal - this is
"pens at dawn" stuff ...

  One of  the problems about  attacking OO programming is  that nobody
can actually agree on what it is.

  When we were researching the Erlang book Robert V. and I went into
the library and  borrowed *every* book there was  that had anything to
say  about OO  programming  - most  of  theses books  gave some  loose
definitions as to what they  thought OOP was - unfortunately there was
little agreement as to what the core ideas in OOP were.

  << This is not quite true - they did agree over one point - they all
agreed that OOP was great - wonderful - amazingly spiffy etc >>

  I strongly  disagree with  the "Everything is  an object"  school of
thinking - I know some people like this but it's not for me.

  Take a <<<simple???>> thing like an integer. Integers
can be defined by simple recursion equations, thus:

	If X is an integer then X ++ "1" is an integer (recursive case)
	"0" is an integer (base case)

  So "0" "01" "011" ... "011111111111111111111111" are all integers.

  Since it is  a bit of a bother  keeping track of all the  1's we use
use simplified notations like "XIV" as an alias for "01111111111111",
but the basic idea is the same.

  (And yes I know this is NOT how we implement it - but at least this
defines what integers are)

  Piano would no  doubt have been greatly surprised  if he was reading
"Java in  a Nutshell"  - he'd look  up integer  in the index  and find
himself reading ...

	public final call Integer extends Number implements Comparable {
	// Public Constructors
	  public Integer(String s) throws NumberFormatException;

  At which point he would no  doubt burst into tears and start banging
his head against the wall ...

  << and yes, I guess you will response that "Joe is attacking Java and
not OOP. He has confused the ideas of OOP with what is present in Java".
To which I would answer "since there is no generally accepted idea as
what OOP means I am forced to pick a specific language which claims to
be an OO language and then tell you what's wrong with it" >>

  It seems to  me much nicer to keep  data structure definitions apart
from the  set of functions  that operate upon them.  Data structure
definitions  are finite and  declarative. The  set of  functions which
operate on them is infinite and (often) imperative.

  We can  *easily* define  a string  as a sequence  of integers  - IMHO
that's what a string *is*. In Erlang:

	+type string() = [int()].

  I looked up  string in the JIAN and to my  surprise *nowhere* did it
say what  a string was.  Instead it  gave a long list  of methods that
could  be used to  turn strings  into other  things (and  I'm guessing
here, I'd bet that nowhere could  I find definitions of what the other
things are :-).

  In English we have "dictionaries" and "books" - Books are full of
paragraphs and sentences, sentences are made of words.

  *If we want to know what a word means we look it up in the dictionary*

  Fortunately dictionaries are not OO - if they were I guess the
dictionary would not only have a definition of the word, but also
have to included all possible citations of the word.

  So when we looked up string, we would find not

	A string is a sequence of integers
  But rather

	A string is a ...
	The word string occurs in the following books ...
		... list of 10 Million books ...

  I rest my case (for now)

  I'll be back


On Sun, 25 May 2003, Chris Pressey wrote:

> I'm not 100% happy with it, but if I keep editing it until I'm 100%
> happy it'll never be done.  So, here is a rebuttal to Joe's essay:
>   http://www.catseye.mb.ca/articles/oodspd.html
> And for more fair time, here is another essay critical of OO that I
> stumbled upon:
>   http://home.planet.nl/~faase009/AoP_OOCH.html
> -Chris

More information about the erlang-questions mailing list