Re: Parents/Child Scripts
Re: Parents/Child Scripts
- Subject: Re: Parents/Child Scripts
- From: Lachlan Deck <email@hidden>
- Date: Sun, 12 May 2002 16:24:36 +1000
Hi there,
From: Michael Kelly <email@hidden>
On 5/11/02 8:56 AM, Paul Skinner <email@hidden> wrote:
Maybe I'm way off-base here, but isn't the OP talking about parent and
child _scripts_? I.e., spawned processes. For instance, the httpd
daemon spawns a new process for each connection, I believe. Therefore,
it is the parent, and the processes it spawns are the children. Am I
correct, or have I been hallucinating? Unfortunately I have real idea
of how to do this, let alone in AS. I'm mostly trying to make sure
that
I'm not gravely misunderstanding something.
You are off-base. Tag!
Parent is a property of every script. It can be declared or not. If
undeclared, a script's default parent is <<script applescript>> ie.
Applescript itself. If declared then a script's parent is the declared
object.
<examples>
Looks like I have some serious reading up to do. Thanks for the
clarification!
The other thing to note from a OO design basis is that the design of the
program is probably back to front if the parent script is doing all the
calling - that's what child scripts are for.
A parent script doesn't, or is that shouldn't, care about the finer
details of it's children (what an uncaring parent ;-)). A parent script
(or class) is like a description or overview - such as a "living thing"
or creature. Within the realm of creatures, there are common
attributes - e.g., alive or dead. The parent script would define and
handle these. Child scripts would be made for Reptiles, Mammals etc
again defining common attributes or things that are for example unique
and common to Reptiles and Mammals etc. Child scripts would be made of
these too - again breaking it down into categories...defining things
that are common.....this continues until you get to a specific creature
that will then define what is unique to that creature.
Through the hierarchy and the unique attributes in the child you have a
full description of that creature. But code reuse is maximised because
the things that were common to the various groups were handled by a
single parent script - which may too be one of a few scripts that has a
common parent.
Only the things that are unique to that creature need to be defined in
the child script - attributes may need to be redefined or extended
beyond the parent. But now you have a good hierarchy.
Is this considered OT - or helpful?
I may be back soon with questions regarding this inheritance stuff :)
--
Michael
with regards,
--
Lachlan Deck
email@hidden
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.