Re: Functional Programming in the Larger or Functional Oriented Software Engineering

Robbert Haarman <[email protected]> Thu, 29 Mar 2007 13:09:02 +0200
Newsgroups gmane.comp.lang.lightweight
Message-ID <[email protected]>
On Thu, Mar 29, 2007 at 08:29:23AM +0200, Peter Van Roy wrote:
> Joe Marshall wrote:
> >
> >In my opinion, `traditional' object-oriented programming (i.e. in the 
> >tradition of Simula-67) is popular because it wraps imperative 
> >programming in a comfy wrapper.  Look at all the elementary texts on 
> >object-oriented programming and you will see that the very *first* 
> >thing introduced is encapsulated state.

Encapsulation is indeed a big win.

> Traditional OO is not the right way to do it.  More recent texts emphasize
> the true advantages of OO that have nothing to do with state, in particular
> polymorphism.

Isn't polymorphism also orthogonal to OO? By the way, what _is_ OO?

> >Of course it is better to be rid of the state altogether, but that 
> >requires learning a new paradigm.

Actually, I don't believe it's possible to do anything useful without 
state. That is not the same as saying that avoiding state when practical 
is not a good idea, but eventually, state will have to be modified.

> >What is really nasty about the current OOP trend is that it actively 
> >encourages the use of state.  The standard container libraries that 
> >come with these languages have tons of methods for modifying, adding, 
> >deleting, iterating over things in a stateful way,

Which is a Good Thing; it's good to be able to express that, although 
the color has been changed, it's still the same car.

> and almost no support for doing things functionally.

And that's where the problem is: many libraries designed for languages 
coming from the C (or maybe ALGOL, but that's before my time) tradition 
seem to simply ignore all of the wonderful things that have come out of 
Lisp, ML, and Haskell. Functional programming support is just one of 
these things.

> Yes, current OO languages such as Java, C#, Python, Ruby, etc. are 
> completely *contaminated* with state.

Ruby, too? It has many functional constructs, too. Often, destructive 
constructs are even marked with a !, as in Scheme. For example, map does 
not modify the object on which it is called, whereas map! does.

Regards,

Bob

-- 
When the blind lead the blind they will both fall over the cliff.
	-- Chinese proverb
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGC55Ofb9wcmD+WN4RAgkVAKDH82v7xzQ1vNuukJ7/7uQeHlsD+QCeKh/r
lIwKbTca8vU1TdKo7U+OrbU=
=zfnV
-----END PGP SIGNATURE-----