Polymorphism

T

Thomas G. Marshall

xarax said:
I have the same complaint about Java hi-jacking the
term "serialization". In computer science for decades
before Java appeared, "serialization" means what Java
thinks is "synchronization". When a process or thread
"serializes", it is synchronizing its processing with
another process or thread.

There's not much consensus on the computer science term
that would mean what Java thinks is "serializing". In
the mainframe world, it is sometimes called "unloading",
and Java "de-serializing" would be called "reloading".
Also, the term "persistence" comes to mind.

So, in the non-Java world, "serializing" causes two
or more processes or threads to proceed in a "serial"
manner (as opposed to concurrent or parallel) through
the use of mutex (mutual exclusion) interface.

Both C# and XML use java's serialization term. And a quick google even
found someone referring to serializing C and Fortran data structures to XML.
 
J

JoeRB

xarax said:
Roedy, you're wrong on this. Don't confuse the newbies.

Overloading is not polymophism. Never has been, never will be.
Two entirely different concepts; you can have one without the
other, or both, or neither, depending on the programming language.

Actually I think Roedy is correct, certainly Cristopher Stratchey (who
is attributed as being the first to define polymorphism in a computer
language context) agrees with his definition.

Also see webster definition:
http://www.webster-dictionary.org/definition/polymorphism

and this journal artical - "Fundamental Concepts in Programming
Languages":
http://www.kluweronline.com/issn/1388-3690
 
C

Chris Smith

xarax said:
I have the same complaint about Java hi-jacking the
term "serialization". In computer science for decades
before Java appeared, "serialization" means what Java
thinks is "synchronization". When a process or thread
"serializes", it is synchronizing its processing with
another process or thread.

That's not exactly accurate. Yes, serialization is used in two
different ways, but it didn't start with Java. I specifically recall
writing training materials in 1995 (prior to Java's public release, and
*well* prior to the existence of ObjectOutputStream and the like) on
programming in C++ with MFC. A technical editor brought up the possible
confusing between my use of the word serialization in the multithreading
chapter versus MFC's serialization (which is vaguely similar to Java
serialization, just less automatic). We replaced all occurrences of
serialization with synchronization to avoid possible confusion.

MFC didn't invent the term either. It's always been a multi-use term,
whose meaning has to be deduced from context.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
C

Chris Smith

Roedy said:
This what happens when you try to highjack an establish term for some
new purpose. You can get away with it when the term has no other
logical meaning in your domain, e.g. "spawn", but that is not the
case here. Polymorphism already had a meaning inherited from
mathematics.

The term polymorphism has *always* meant type-based delivery of messages
in an OO context. It has never meant the ability to deliver separate
messages that go be the same name. Frankly, I'm quite surprised to hear
that polymorphism might possibly include overloading in anyone's
experience. The definition of polymorphism is not a new development,
but has in fact been around for quite a number of decades now.

Definitions from biology, mathematics, and especially Greek roots are
irrelevant. These are of concern for etymology only; they are useful
for understanding *why* a term was chosen to represent a concept in a
different field, since terminology is borrowed; but they are useless for
understanding precisely what the term means in a different field.

As a different example, biology appropriated the term "evolution"
ultimately from unrolling of books, without at all applying that the
mechanism of what was meant by "evolution" in biology is the same as
that meant by "evolution" in books. Darwin refused to use the term
because it had too many implications of things not included in his
theory, but eventually it was adopted, with the understanding that not
all implications of the word "evolution" applied to its new context
(although the crackpot sociologist Herbert Spencer propogated its use
primarily with the ultimate purpose of encouraging some of those
connotations that Darwin rejected). That's not unique to biology,
either; such situations are commonplace and to be expected, because the
pre-existing word will *never* explain all the nuances that it will take
on in a new field.
It makes about as much sense as calling it polyamory.

Indeed, and if it were called polyamory, that's what we'd call it. We
wouldn't require there to be any of the complex social phenomena that
accompany polyamory in real life (for example, it wouldn't be illegal),
and yet the word would work just fine.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
T

Thomas G. Marshall

Chris Smith said:
The term polymorphism has *always* meant type-based delivery of
messages in an OO context. It has never meant the ability to deliver
separate messages that go be the same name. Frankly, I'm quite
surprised to hear that polymorphism might possibly include
overloading in anyone's experience.

Section 1.3.

http://research.microsoft.com/Users/luca/Papers/OnUnderstanding.A4.pdf

Polymorphism types (go monospaced font):


Parametric
/
Universal
/ \
/ Inclusion
Polymorphism
\ Overloading
\ /
ad-hoc
\
Coercion


That link is a spectacular read. I urge anyont to look at section 1.3.

Thomas

....[slash]...
 
B

Ben Wilson

JoeRB said:
Actually I think Roedy is correct, certainly Cristopher Stratchey (who
is attributed as being the first to define polymorphism in a computer
language context) agrees with his definition.

This debate is giving me the heebie-jeebies.

First, Roedy's updated his definition to respect the newbie-ness of a
presumed newbie, who may or may not still be with us. I'd assume that for
your run-of-the-mill newbie, polymorphism is used to explain the four
foundations of object orientation, as in encapsulation, abstraction,
polymorphism, and inheritance. Certainly by expanding this version of
polymorphism to include things that exist outside of the object-oriented
context, well, this could be confusing to a newbie. Roedy can do whatever he
wants to on his website, and I don't know who this xanax fellow is so I
don't really understand Roedy's instant reaction.

On the other hand, conceptually I do feel that saying polymorphism, when
considering the whole of all name reuse in Java, should be applicable to
overriding (where nothing changes to the signature) and not to overloading
(which can only take place when things change) is missing the "poly" bit and
the "morphism" bit.

Can't we say that polymorphism, when used to describe the object-oriented
characteristics of a language, refers to the ability of an object to
override methods in a parent class; but that when used to describe the
ability of the programmer to reuse names, refers to overriding, overloading,
and the shadow-hiding-thing that static methods do to methods of a parent
class and inner classes do to methods of an outer class?

B.
 
J

JoeRB

Ben Wilson said:
This debate is giving me the heebie-jeebies.

First, Roedy's updated his definition to respect the newbie-ness of a
presumed newbie, who may or may not still be with us. I'd assume that for
your run-of-the-mill newbie, polymorphism is used to explain the four
foundations of object orientation, as in encapsulation, abstraction,
polymorphism, and inheritance. Certainly by expanding this version of
polymorphism to include things that exist outside of the object-oriented
context, well, this could be confusing to a newbie. Roedy can do whatever he
wants to on his website, and I don't know who this xanax fellow is so I
don't really understand Roedy's instant reaction.

I can understand not wanting to go beyond the realms of Java in the
definition of polymorphism, but since overloading is a feature of Java
I would have thought it was relevant.
On the other hand, conceptually I do feel that saying polymorphism, when
considering the whole of all name reuse in Java, should be applicable to
overriding (where nothing changes to the signature) and not to overloading
(which can only take place when things change) is missing the "poly" bit and
the "morphism" bit.

It both cases things change the difference is what changes and when.
Take the + operator as a example, the implementation depends upon the
types to which it is applies, this is clearly polymorphism (there are
many forms, which form is chosen depends on the type to which it is
applied).
Can't we say that polymorphism, when used to describe the object-oriented
characteristics of a language, refers to the ability of an object to
override methods in a parent class; but that when used to describe the
ability of the programmer to reuse names, refers to overriding, overloading,
and the shadow-hiding-thing that static methods do to methods of a parent
class and inner classes do to methods of an outer class?

B.

I generally agree with the above statement, in that OOP languages are
required to support the run-time type of polymorphism, not
overloading. Therefore you could argue that in purely a OOP context,
polymorphism refers to the run-time variant.

However, the point is that polymorphism is already a well-defined term
in the context of computer languages and that definiton happens to
include overloading (as well as other forms of polymorphism outside
the realm of Java and OOP such as Parametric polymorphism).
 
T

Tony Morris

Ben Wilson said:
This

Ahem, what I meant to say, was, this is at best inheritance, not
polymorphism. :)

There are two forms of polymorphism ("poly" meaning "many" and "morph"
meaning "form") in the context of computer science.
One is as you mentioned.
For example, given a List l, it can take on "many forms";
as an ArrayList:
l = new ArrayList();
or as a LinkedList();
l = new LinkedList();
etc. etc.

The other, less well known type of polymorphism, is termed "parametric
polymorphism" and is synonymous with what is also called "method
overloading". i.e. a method (or function depending on context) takes on many
forms.
For example, given a method m, it can take on many forms;
m(){}
m(int i){}
etc. etc.
 
J

Joona I Palaste

xarax said:
Will someone please mention Hitler, so this
thread will cease?

It doesn't work that way. First, you have to compare some other
participant to Hitler, merely mentioning Hitler is not enough.
Otherwise, discussion that is actually about Hitler (for example on
political history newsgroups) would be impossible.
Second, it's been said that you can't purposefully compare someone to
Hitler just so you could lose the argument and end the thread. You have
to make a real insult.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,785
Latest member
undedgini

Latest Threads

Top