Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Paul Snively <psnively@mac.com>
To: Robert Morelli <morelli@cs.utah.edu>
Cc: Ville-Pertti Keinonen <will@exomi.com>,
	Kyle Consalus <consalus@gmail.com>,
	caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Some Clarifications
Date: Sun, 24 Jul 2005 11:51:16 -0700	[thread overview]
Message-ID: <AD3673F4-A477-4C94-AAE8-2FDDE707CB0E@mac.com> (raw)
In-Reply-To: <42E34C83.1090402@cs.utah.edu>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Jul 24, 2005, at 1:08 AM, Robert Morelli wrote:

> What you've quoted here is a direct and emphatic statement that what I
> wanted to discuss is something I believe is a technical issue,  not a
> conspiracy of large corporations, not an attack on a poster's
> credibility,  not a claim that some broadly useful language is
> horrendously bad,  not rhetorical deceptions,  not advocacy,  not ad
> hominem diversions.  You didn't include it in your quote,  but I also
> pointed out that functional programmers are prone to a  
> counterproductive
> form of advocacy and focus on low level issues and that they have
> generally been unsuccessful at providing practical documentation.   
> I do
> lament that,  and it is directly relevant to the original poster's
> question,  but I primarily raised that point to underline that I  
> believe
> the lack of a "theory" of large scale design issues is not a result of
> it.
>
> You may disagree with me,  and you may find my statements  
> provocative or
> unsettling,  but you cannot claim that I attempted to use a game of
> rhetorical deception,  advocacy,  or ad hominem diversions.

Hmmm. Given your lack of supporting citations or even anecdotes from  
personal experience behind your assertions, I have to take issue with  
your claim of lack of "advocay or ad hominem diversions," if you  
accept the notion of "ad hominem" arguments against a technology.  
Still, let's accept your claim of sincerity. What can those of us who  
do functional programming, particularly because we find it pleasant  
and have come from an extensive object-oriented background, say to that?

The first observation that I would make is that, in my experience,  
object-orientation as we find it in popular programming languages  
either doesn't support large-scale software engineering without  
employing idioms that present issues of their own, such as C++ with  
its lack of a module system and the Pimpl Idiom, lack of virtual  
constructors, bizarre multiple inheritance resolution semantics,  
abstract base classes via the declaration "= 0" trick, etc.) or Java  
with its distinction between primitive types and object types,  
package system  that doesn't enforce a distinction between interface  
and implementation (but at least Java has Interface and Class; it's  
just that using them well is a matter of self-imposed discipline),  
all objects inheriting from One True Object, arrays being a subclass  
of Object but null not being, all parameter passing effectively being  
by reference (i.e. no value semantics), no polymorphic constructors,  
no enumerations, and so on. Couple this with a general lack of  
understanding of the issues in ensuring that object-oriented  
programming respects the contracts expressed in the total context at  
hand: as Peter Norvig has observed, object-oriented programming is a  
discipline that requires you to understand not only what you do  
write, but what you don't. This observation led to Betrand Meyer's  
Eiffel language and "Object-Oriented Software Construction, 2nd ed."  
It's also led to the Liskov Substitutability Principle, the  
definition of which is a question I use in interviews, and it never  
ceases to amaze me how many programmers don't know it, and even if  
they do know its definition, violate it in their code. By the way,  
OOSC is one of the handful of volumes in the OO world that lends  
credence to your claim that OO has theory behind it. Abadi and  
Cardelli's "A Calculus of Objects" is one of the few others. But the  
issues in object-orientation are very real, even if you are  
extraordinarily careful to separate interface from implementation and  
adhere to the Liskov Substitutability Principle; see <http:// 
okmij.org/ftp/Computation/Subtyping/> for details. Basically, a  
common problem in object-oriented programming is the confusion of  
subtyping and subclassing, as Oleg's explanations help clarify.

An unfortunate upshot of the poor modularization support of C++ and  
Java is that C++ and Java programmers tend to turn classes into  
structural dumping grounds. I've been guilty of this myself on rare  
occasions, and even more often have been guilty of not correcting it  
when I've been maintaining someone else's code, just because I've  
judged that schedule pressures don't allow for such refactoring  
efforts. One reason that it may seem that there's more "theory of  
large-scale design" in object-orientation is precisely because the  
industry has had to identify idioms--that is, extra-lingual localized  
coding patterns--and patterns--slightly-larger-scale combinations of  
idioms that reflect a concept that lacks direct expression in the  
language family in question--to work around the problems with object- 
orientation as we find it in these popular languages. For example,  
<http://norvig.com/design-patterns/> helps explain that "16 of 23  
patterns have qualitatively simpler implementation in Lisp or Dylan  
than in C++ for at least some uses of each pattern." It's also worth  
noting that functional programming is making its way into C++, most  
apparently thanks to the Standard Template Library and its  
"functional" header and standard algorithms, but also by way of more  
featureful libraries such as Boost Lambda, the Phoenix library hiding  
inside Boost Spirit, or <http://www.cc.gatech.edu/~yannis/fc++/>. At  
the latter site, we also find a very interesting paper, "FC++:  
Functional Tools for OO Tasks."

So what are the aspects of functional languages in general, and  
O'Caml in particular, that I find to support good large-scale  
software engineering?

1) higher-order functions
2) structural, vs. nominal, typing
3) an excellent module system, with functors
4) an excellent object system leveraging all of the above, with C++- 
level power, but much more safety
5) good libraries leveraging all of the above
6) an excellent community leveraging all of the above

Witness, e.g. the thread regarding "The right way to do this in  
O'Caml?" it deals with some subtle issues and comes up with some very  
helpful answers, while also helping to identify some outstanding  
questions.

Having said all of this, I can't help but suspect that there are some  
things that we'll just have to agree to disagree about, e.g. that  
"language tools" and "formal methods" are simple domains. I also see  
some unique benefits in functional programming for mathematics,  
whether symbolic or concrete, but there are others here who either  
have chimed in on those subjects, or can do so much more ably than I  
can. All I wanted to do what to provide some pointers to some  
explanations of what some of the issues in OO are, some of the pluses  
of functional programming are, and leave you to examine them at your  
leisure. Given your particular focus on programming-in-the-large, let  
me particularly recommend the literature on module systems. The  
papers on O'Caml's module system can serve as an excellent starting  
point.

Best regards,
Paul Snively

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iEYEARECAAYFAkLj4zMACgkQO3fYpochAqLPGgCgv+pXvI9Sd1DuWrJXe3hV4tF2
yy8An3nBP8fhTU3Cm28YGpttZpjOXhUz
=ZDOi
-----END PGP SIGNATURE-----


  parent reply	other threads:[~2005-07-24 18:51 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-14 18:00 (Mostly) Functional Design? Kyle Consalus
2005-07-18  7:59 ` [Caml-list] " Robert Morelli
2005-07-18  9:22   ` Alex Baretta
     [not found]     ` <42DB78D3.7010401@andrej.com>
2005-07-18 10:01       ` Alex Baretta
2005-07-18 18:15     ` Robert Morelli
2005-07-18 18:45       ` Alex Baretta
2005-07-18 18:56       ` padiolea
2005-07-18 19:19         ` Jon Harrop
2005-07-18 19:38       ` Jon Harrop
2005-07-18 21:27       ` skaller
2005-07-18 21:55         ` Alwyn Goodloe
2005-07-18 22:16         ` Paul Snively
2005-07-19  0:45           ` Jonathan Bryant
2005-07-18 21:37       ` skaller
2005-07-18 22:00     ` Kenneth Oksanen
2005-07-18  9:29   ` Mark Meyers
2005-07-18  9:56   ` Large scale and FP (was: Re: [Caml-list] (Mostly) Functional Design?) David MENTRE
2005-07-18 18:11     ` Large scale and FP Robert Morelli
2005-07-18 14:08   ` [Caml-list] (Mostly) Functional Design? james woodyatt
2005-07-18 16:37     ` Alwyn Goodloe
2005-07-18 14:21   ` alphablock
2005-07-18 15:26     ` Alex Baretta
2005-07-18 15:38       ` alphablock
2005-07-18 17:17       ` Doug Kirk
2005-07-18 18:14         ` Alex Baretta
2005-07-19  7:42         ` james woodyatt
2005-07-19  9:35           ` Robert Morelli
2005-07-19 16:53             ` james woodyatt
2005-07-19 17:13               ` Paul Snively
2005-07-19 23:58                 ` Jon Harrop
2005-07-20  0:29                   ` Paul Snively
2005-07-18 18:23   ` padiolea
2005-07-18 19:45   ` Gerd Stolpmann
2005-07-18 22:16     ` skaller
2005-07-19  0:48   ` Chris Campbell
2005-07-19 20:14   ` Some Clarifications Robert Morelli
2005-07-20  6:18     ` [Caml-list] " Ville-Pertti Keinonen
2005-07-24  0:04       ` Robert Morelli
2005-07-24  2:30         ` Paul Snively
2005-07-24  7:37           ` Alex Baretta
2005-07-24  8:08           ` Robert Morelli
2005-07-24 12:23             ` David Teller
2005-07-24 18:29             ` skaller
2005-07-24 18:51             ` Paul Snively [this message]
2005-07-24 12:42         ` Gerd Stolpmann
2005-07-25  7:23         ` Ville-Pertti Keinonen
2005-07-20  7:34     ` David MENTRE
2005-07-27 15:37       ` Robert Morelli
2005-07-27 20:33         ` skaller
2005-07-27 23:48           ` Paul Snively
2005-07-20 16:28     ` Damien Doligez
2005-07-24 14:51       ` Robert Morelli
2005-07-24 16:11         ` David MENTRE
2005-07-25 12:21         ` Damien Doligez
2005-07-25 15:47           ` Richard Jones
2005-07-22  5:18   ` [Caml-list] (Mostly) Functional Design? Marius Nita
2005-07-27  9:38 [Caml-list] Some Clarifications Don Syme
2005-07-27 10:58 ` Jon Harrop
2005-07-27 11:55   ` Robert Roessler
2005-07-27 14:01     ` Richard Jones
2005-07-28  0:29       ` Robert Roessler
2005-07-27 18:42     ` skaller
2005-07-27 13:36   ` David Thomas
2005-07-27 13:53     ` Ville-Pertti Keinonen
2005-07-27 16:23   ` james woodyatt
2005-07-27 14:32 David Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AD3673F4-A477-4C94-AAE8-2FDDE707CB0E@mac.com \
    --to=psnively@mac.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=consalus@gmail.com \
    --cc=morelli@cs.utah.edu \
    --cc=will@exomi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox