[Tutor] OO terms and definitions

Jeff Shannon jeff@ccvcorp.com
Mon, 10 Dec 2001 10:30:11 -0800


> On Mon, 10 Dec 2001 09:56:35 -0500,
> dman <dsh8290@rit.edu> wrote:
>
> On Mon, Dec 10, 2001 at 11:24:55AM +0000, alan.gauld@bt.com wrote:
>
> | > You can pretty much use the terms interchangeably, except when you get
> | > into the semantic details of "function" vs. "unbound method" vs.
> | > "bound method".
> |
> | But only if you want to perpetuate the confusion that caused
> | the poster to ask the question! Its much better for everyone
> | if we all use the terms correctly IMO!
>
> Well, what is "correctly"?  I gave 4 examples of correct, but
> different usages (or non-usages) of the terms, and each is considered
> correct by their respective community.  It becomes even more difficult
> when you frequently work with 2 or more languages.  People are
> creatures of habit.  If I spend most of my time in python calling the
> things "functions", then when I do some java I'll likely call it a
> function there, and vice-versa.

As I understand it, Java doesn't allow anything outside of class definitions,
and therefore requires everything to be a method.

It seems that a fairly standard usage (from my limited experience), is that
methods belong to classes, functions don't.  I've seen this usage in Python,
BASIC, C++ (though often "member function" replaces method, as noted), and the
few bits about Smalltalk that I've read.  The distinction between functions
and procedures (or subroutines) doesn't exist in some languages, but where it
does, it depends on the return value--functions return a value, procedures
don't.


> If everyone could agree on a single set of correct terms then it would
> be easier to prevent the confusion.  In addition, the terms should not
> have such slight semantic differences because that makes the
> terminology just as confusing as some code.

No arguments on that!  :)

Jeff Shannon
Technician/Programmer
Credit International