• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [OT?] Multiple Inheritance (was Re: hash arrays and other mysteries)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OT?] Multiple Inheritance (was Re: hash arrays and other mysteries)


  • Subject: Re: [OT?] Multiple Inheritance (was Re: hash arrays and other mysteries)
  • From: Paul Skinner <email@hidden>
  • Date: Tue, 23 Oct 2001 09:22:46 -0400

on 10/23/01 8:29 AM, Chris Page wrote:

> [Warning: Long, possibly off-topic, lecture in OOP coming up...don't let me
> type late at night when there's nobody to interrupt me...:-]
>
> nigh on 2001.10.22 2:10 PM, Paul Skinner at email@hidden wrote:
>
>>> AppleScript doesn't have multiple inheritence, true. But neither does
>>> Smalltalk or Java. From an object-oriented design perspective, multiple
>>> inheritence is questionable.
>>>
>> Hmmm. I'm trying to think of why it's questionable. Complexity?
>> Anyway, AppleScript does have it. No, a script can't have two parents,
>> but it can have a family tree.
>> If the script which is a script's parent has a parent then the child
>> script ( or grandchild script ) inherits from both parent scripts.
>
> What you're describing is still called single inheritance; there's only one
> line of inheritance through all the parents, and the direct parent can
> modify any of its parents or their parents, etc. In multiple inheritance, a
> child can have more than one direct parent, and those parents do not usually
> modify each other's behavior or attributes.
>
> To answer your question: In fact, multiple inheritance (MI) can often reduce
> complexity found in a single inheritance (SI) class hierarchy.
>
> For example, MI can be used to simplify and flatten an object hierarchy. If
> you have the following classes: <bird>, <dove>, <penguin>, you might arrange
> them in this hierarchy:
>
> <bird>
> / \
> <dove> <penguin>
>
> But what if you want to have a "fly" handler? Doves fly, but penguins don't.
> When you only have SI, you might arrange it like this:

SNIP a great deal of OOP info

> 'Course, you can go overboard in the other direction with MI and have a
> fragmented collection of classes with no obvious relationships. You have to
> properly use MI and SI as tools to strike the right balance.
>
> Hope I haven't bored anyone.

I'm not bored. But I am having a hard time relating your metaphor to
AppleScript programming. Probably because the last course I took in
programming was in Cobol and that was in the early eighties.
I must admit that I am not familiar with some of the modern concepts of
OOP. Can you give me a simple AppleScript example of the hierarchy you
describe above? I think I'm tripping over the metaphor.
Also, when you describe Classes how does this relate to individual
handlers in a script server being made available to child scripts and to
other handlers?

Thanks for the info,
--
Paul Skinner


References: 
 >[OT?] Multiple Inheritance (was Re: hash arrays and other mysteries) (From: Chris Page <email@hidden>)

  • Prev by Date: Re: copy & set statements
  • Next by Date: Re: copy & set statements
  • Previous by thread: [OT?] Multiple Inheritance (was Re: hash arrays and other mysteries)
  • Next by thread: Re: hash arrays and other mysteries
  • Index(es):
    • Date
    • Thread