## Polymorphism

Expand Messages
• ... Polymorphism and isomorphism have
Message 1 of 100 , Jul 28, 2002
> > Could you explain polymorphism to me in a few words? I
> > would love to hear them.
>
>Sure. It means that you can send a message to (or call a
>function of) an object without knowing what specific type
>of object it is. The object itself will take the appropriate
>action based on its type. Different objects respond
>differently to the same call.

<<Good start, but not yet clear to me. Plus I would like to explore
polymorphism for as an example of isomorphy.>>

Polymorphism and isomorphism have nothing to do with each other, other than
the first means "many shapes" and the second means "equivalent shapes".

All right isosceles trianges are isomorphic no matter their size. Ditto
squares.

The natural language example of polymorphism I've found is "answer".
To answer a letter is different thant
to answer a phone is different than
to answer a question is different than

A programmer would create a method for each kind of object:
and the contents would be quite different.

More to programming, the area under a parabola is computed quite differently
than the area of a square, and yet the INTENT is very much the same. Thus a
program would contain the phrase "a.area() + b.area()" and not care whether a
and b were both parabolas, both squares, or some combination. "area()" is
polymorphic.

More to business, a product has a price, an invoice line item has a price, an
invoice has a price, all computed differently. It is very very handy
compute:
invoice.price( ) = sumOfAll ( invoiceLineItem.price() )
where
invoiceLineItem.price() = product.price() * quantity.
and
product.price() = derived from some lookup into some table.

so "price()" is computed very differently, but carries the same intent, and
the code is simplified by the use of polymorphism.

As you can see, has nothing to do with isomorphism, which is a comparison of
similarity between two things.

====================================
Alistair Cockburn
Humans and Technology
Cockburn and Associates

Author of
"Surviving Object-Oriented Projects" (1998)
"Writing Effective Use Cases" (Jolt Productivity Award 2001)
"Agile Software Development" (Jolt Productivity Award 2002)

Contact Information:
alistair.cockburn@...
1814 E. Fort Douglas Circle
Salt Lake City, UT 84103
Work Phone: 801.582-3162
Fax: 775.416.6457

"La perfection est atteinte non quand il ne reste rien a ajouter,
mais quand il ne reste rien a enlever." (Saint-Exupery)

http://www.crystalmethodologies.org
http://members.aol.com/acockburn
http://www.usecases.org
• Hi, Jeff, Dossy, John, Brad, Everybody!! ... And a one and a two and... uh... wrong rhythm... ... Gee, Jeff, did you go to MIT??? Thanks to all for *all* the
Message 100 of 100 , Aug 3, 2002
Hi, Jeff, Dossy, John, Brad, Everybody!!

> -----Original Message-----
> From: jeffgrigg63132 [mailto:jgrigg@...]
> Sent: Saturday, August 03, 2002 1:50 PM
> To: extremeprogramming@yahoogroups.com
> Subject: Re: [XP] Lambada Calculus -vs- lambda-calculus
>
>
> (A pun on "lambda-calculus") Teaching logic thru spanish dance steps.
> Invented by P. van der Linden .
> (1996-08-10)
> -- foldoc

And a one and a two and... uh... wrong rhythm...

>
>
> Now as for "lambda-calculus"...
> See: http://onlinedictionary.datasegment.com/word/lambda-calculus
>
> "A branch of mathematical logic developed by Alonzo Church in the
> late 1930s and early 1940s, dealing with the application of functions
> to their arguments." ... "Most functional programming languages are
> equivalent to lambda-calculus [with some convenient extensions]."
> (It's used in the LISP language, for instance.)
>
>
> As a practical matter, it's a syntax for defining functions --
> often "at run time."
>
> It's assumed that functions have no "side effects." That is, that
> they perform some operation on their input arguments and return a
> complex result -- but do not change global variables or data on disk
> as a "side effect."
>
> To do this in Visual Basic, your functions would have to return
> Collections and arrays, and many elements of those would be
> Collections and arrays and other complext types, down to some
> arbitrary level of nesting. This could be really confusing in Visual
> Basic, but it can be an effective approach to handle complex
> processing problems if done consistently, with appropriate language
> support.
>
> Historically, these concepts have been used in artificial
> intelligence and other highly data-driven applications.

Gee, Jeff, did you go to MIT???

Thanks to all for *all* the answers... sorry it took me so long to respond!!

I didn't know unemployment would be so *hectic*!!

First installment of Kay's Excellent Adventure at the XP Workshop starts
next week!!

Stay tuned!

Kay

>
>
>
> --- Dossy <dossy@p...> wrote:
> > Lambada calculus is a derivative of the sensual dance made popular
> > in Brazil but employs a deep understanding of mathematics as part
> > of the sensual ritual.
> > -- Dossy
>
> > On 2002.08.02, jbrewer999 <jbrewer@j...> wrote:
> > > "Kay A. Pentecost" <tranzpupy@i...> wrote:
> > > > Now, what's lambda calculus...<ducking>
>
>
>
> To Post a message, send it to: extremeprogramming@...
>
> To Unsubscribe, send a blank message to:
> extremeprogramming-unsubscribe@...
>