Eppur si sugat

Chris Pressey cpressey@REDACTED
Tue May 27 23:28:52 CEST 2003


On Tue, 27 May 2003 10:40:00 +0200 (CEST)
Joe Armstrong <joe@REDACTED> wrote:

>    Eppur si sugat (was that right?)

(Not sure - Google just gave me a blank look when I tried it...)

>    Hi Chris,

'lo Joe,

>    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.

Well, that's a problem.  I don't think the merits of any given thing can
be productively debated until the participants can mostly agree on what
they're debating.

FWIW, I see OO as (I'll do my best to summarize)
- a design philosophy rather than a style of coding
- splits function and state up into units which may represent both
- emphasizing mutual respect across discrete units (encapsulation)
- also emphasizing similarity and interoperability between those units
(inheritance and polymorphism)

If that doesn't strike you as an acceptable premise, there's not much
point.  I just want to make it clear that I'm just looking for fair time
- showing the other side of the argument - rather than showing that one
side is "wrong".

I think most differences between my premise and those of people who,
say, have written books on the subject, is that their premises are more
formal and more detailed (often MUCH more detailed) - otherwise I think
we *basically* agree.

And to me, it doesn't matter that these things aren't the exclusive
domain of OO - recursion isn't the exclusive domain of lambda calculus
either AFAICT...

>   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 >>

Yeah, that's the "glamour" thing, as I'm sure you're well aware.

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

I have my own reservations about "Everything is X" because, well,
"Everything is Everything" (Lauren Hill :)

>   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)
> [...]
>   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 ...

Whereas Bertrand Russell might grin.
("Integer specializes rational" might even make him smile.)

But neither Russell nor Peano is "wrong" (and I don't think either of
us is qualified to speak for the emotional reactions of dead
mathematicians anyway) so the question might be better put as: which way
of defining an integer is more productive for the average systems
designer?

> [...]
>   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*.

I would say it's an ordered set of symbols, but those two views aren't
too different, so, OK.

> In Erlang:
> 
> 	+type string() = [int()].
> 
>   I looked up  string in the JIAN and to my  surprise *nowhere* did it
> say what  a string was.

And this is OO's fault?  :)  It's probably not even Java's fault. 
There's only so much you can pack into a nutshell.

If you really need an OO model of a string, I can supply you with one
(in any of a number of OOPLs or modelling notations or natural
languages,) for instance:

  +--------+         +--------+
  | String |<>------*| Symbol |
  +--------+   (ord.)+--------+

> 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 :-).

Let's go back to Peano, then:

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

This doesn't tell me what an integer "is", either.  It gives me one
example ("0") and a method for turning integers into other integers.

>   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*

(Which, I feel I should note, defines words in terms of other words)

>   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.

Sorry - insofar as I follow you, I don't agree.

Even an "OO dictionary" wouldn't have to list every possible citation of
the word, merely every possible *form* of citation of a word.  And
dictionaries *do* do this, by giving the word's class (noun, verb, &c)
and further with "notes on usage" - *examples* of citations from which
the reader infers the set of possible citations.

>   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 ...

Or perhaps

        A string is some X such that
           operation 1 can be done to it to yield blah and
           operation 2 can be done to it to yield foo and
           operation 3 can be done to it to yield bar and ...
           operation n can be done to it to yield !&%*@ and
       "" is a valid string

Which is not at all different in form from Peano's axiom.

Also, please remeber JIAN is a "nutshell" work - so of course it's going
to concentrate on indexes and glossaries (which are hard for a Java
programmer to remember) instead of definitions (which, for brevity, it
can assume they have already learned and don't need reminding of.)  So I
don't think the comparison to a dictionary is an entirely fair one.

>   I rest my case (for now)
> 
>   I'll be back

I'll be waiting :)

>   /Joe

-Chris



More information about the erlang-questions mailing list