code reuse [was: Re: AppleScript a miserable and utter failure]
code reuse [was: Re: AppleScript a miserable and utter failure]
- Subject: code reuse [was: Re: AppleScript a miserable and utter failure]
- From: has <email@hidden>
- Date: Thu, 29 Sep 2005 09:14:32 +0100
Shane Stanley wrote:
> > AppleScript programmers, unlike Perl programmers, are flat-out resistant to
> > using 'libs' or 'mods'.
>
>That's true. One reason, I think, is because the really hard work for a lot
>of scripters is not so much in things like list handlers or date handlers,
>but in dealing with the applications.
>[...]
>One of the things I find -- and many others have also commented on -- is how
>little of what we seem to do lends itself to reusable subroutines.
I don't buy that argument. I think the real reason is that writing non-trivial reusable code is HARD, and requires a level of knowledge and skill that most ASers, not being trained professional programmers, don't have. It also requires foresight, planning and time, and a willingness to put long-term benefit over short-term cost; factors that often scupper attempts at formal code reuse even for professionals.
>Sure, we reuse stuff all the time -- but very often with changes. So you end up ... taking [a subroutine] you already wrote for something similar and modifying it to suit.
That sort of statement's a honking big flag to anyone looking to refactor code into reusable chunks; gold dust to a '49er. But unless you know all the tricks and techniques for transforming it from here to there (and have the time and support needed to do it), you ain't going to be able to make it happen (or not effectively enough to reap the benefits anyway).
>I'm thinking about the sorts of scripters I meet, who tend to be scripting the sort of apps I do -- InDesign, QuarkXPress, Illustrator, and so on. And that's where efficiencies have a huge bearing on performance (and often where performance really matters).
Insert obligatory 'premature optimisation is the root of all evil' comment here.
>Now maybe we just need re-educating in the Right Way. Or maybe just as
>AppleScript seems to annoy people like John Gruber and Doug McNutt, it
>attracts people who are more comfortable with a different approach.
A technically inferior approach, true. But never underestimate the vast power of "Worse is Better". I mean, given the choice between drinking beer, chasing girls, enjoying sunny afternoons in the park, or spending several years locked in a dark room slaving away to become a Level 18 Code Mage, which would most folks here rather do? :p
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden