From: Erik Naggum

Subject: Re: Different argument list for same method name

Date: 2000-11-14 20:06

* David Kaasen
| I am writing a program in LISP, using CLOS. I designed
| two independent classes, both with a method called 'add'.

  Well, not to put you down or anything, but that is a pretty good
  sign that you are thinking in entirely wrong terms right there.
  CLOS classes do not have methods -- CLOS generic functions do.
  "Add" says nothing (specific) about what you do, so it is a lousy
  name for a _generic_ function -- it relies on its distinguished
  (dispatching) argument for meaning, and that is the flaw in your
  design.  In C++ and Java, you can (should) do this, because you do
  not have generic functions, you have classes that own their methods.

  This not so slight difference in design between the OO paradigms
  leads to very different coding styles and function, method, class,
  and instance naming conventions.  The question of who owns something
  is important to this other design, leading to such abuses as the
  available types of one distinguished argument dictating the rest of
  the argument list of the function.  I have personally never come to
  peace with this design and I feel terribly frustrated with similar
  names hen the function they perform are outrageously different, like
  using + for string concatenation and matrix addition.

| Of course a solution could be to give the methods different names,
| but I think that is unsatisfactory.

  Would you explain why you think so?  Why is "add" such a good name?

#:Erik