Re: What's good program design in applescript?
Re: What's good program design in applescript?
- Subject: Re: What's good program design in applescript?
- From: "Arthur J. Knapp" <email@hidden>
- Date: Fri, 27 Sep 2002 15:27:46 -0400
>
Date: Sat, 28 Sep 2002 01:26:17 +0800
>
Subject: What's good program design in applescript?
>
From: bill <email@hidden>
>
Recently my friend gave me this link about programming:
>
How To Write Unmaintainable Code
>
http://mindprod.com/unmain.html
Wow, this is really funny!!! I resemble some of the remarks...
;-)
>
Quite long article, after reading some of the sections, may I ask what9s
>
good program design & maintainable code in applescript?
Are you TRYING to start a flame war? ;-)
>
Are handlers and script objects a must?
Script objects? No, not a *must*. They *can* make some complex scripts
more readable or maintainable, but they do not nessesarily do so.
Handlers, well, it depends on what you are doing. A large number of
AppleScript projects are very small, ie: many people create scripts
to do very simple actions. There is no reason to believe that using
handlers in such a script is going to make the script any more
"maintainable". The main point of a handler is to reuse the same bit
of code over and over again, possibly with different parameters. I
have seen many scripters who simply cut and paste the same code
snippit over and over again in their script, who then complain about
the 32k Script Editor limit. ;-)
I am reminded of a beautiful one-line code snippit once posted by
Nigel Garvey...
tell (current date) to set fifthBusinessDay to its day > 7 or (its day >
5 and its weekday is Saturday) or (its day is 7 and its weekday is Sunday)
... which, with a little bit of whitespace formatting:
tell ( current date ) to set fifthBusinessDay to
( its day > 7 ) or
( its day > 5 and its weekday is Saturday ) or
( its day is 7 and its weekday is Sunday )
... is simutaneously a *good* AND *bad* example of AppleScript source code.
;-)
{ Arthur J. Knapp, of <
http://www.STELLARViSIONs.com>
a r t h u r @ s t e l l a r v i s i o n s . c o m
}
_______________________________________________
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.