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

Peter Van Roy <[email protected]> Thu, 29 Mar 2007 08:29:23 +0200
Newsgroups gmane.comp.lang.lightweight
Message-ID <[email protected]>
Joe Marshall wrote:
> Yeah, this thread is dead, but I put a star next to it so I would 
> remember to
> follow up when I had some time.
>
> 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.
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.
> Of course it is better to be rid of the state altogether, but that
> requires learning
> a new paradigm.
It's actually not a good idea to completely get rid of state, because using
state can give programs with good modularity properties, which is not
possible without state (see, e.g., the explanation in the CTM book).  But
you're right, state should definitely not be the default.
> 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, and almost no support for doing things functionally.
Yes, current OO languages such as Java, C#, Python, Ruby, etc. are 
completely
*contaminated* with state.  It requires a lot of programmer discipline 
to write
good programs in them.

Peter Van Roy