• 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: Scripting stylistic question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Scripting stylistic question


  • Subject: RE: Scripting stylistic question
  • From: "Grimm, Kenneth" <email@hidden>
  • Date: Tue, 5 Apr 2005 18:01:11 -0400

Thanks to has and Adam! This is exactly what I was hoping for. --Ken

> ----------
> From:
> applescript-users-bounces+kgrimm=email@hidden on
> behalf of has
> Sent: 	Tuesday, April 5, 2005 12:14 PM
> To: 	email@hidden
> Subject: 	Re: Scripting stylistic question
> Message Flag: 	Follow up
> Flag Status: 	Flagged
>
> Adam Wuellner wrote:
>
> >'Code Complete'
>
> Second that. Basic programming knowledge and techniques I got from reading
> high school textbooks (always a good place to start), but beyond that much
> of what I know about good design and programming practice I learned from
> CC. Also: practise, practise, practise. As you read CC, look at lots and
> lots of code - both your own and others' - and critique the hell out of
> it, identifying what's good and what's bad about it and making
> improvements.
>
> Learning how to program is orthogonal to learning how to read and write
> code in a particular language, so don't worry that CC doesn't mention
> AppleScript directly as this is a complete non-issue. Also, don't bother
> reading CC from cover to cover: chapters are largely self-contained, so
> you can dive in and just read the bits you're interested in as-and-when
> you need them and in whatever order best suits you.
>
>
> In addition to knowing how to write good, clean, well-structured code, the
> other thing is to know your way around the particular tools you're dealing
> with: the AppleScript language, Apple Event Object Model, and scriptable
> applications you're dealing with. That'll help you avoid stuffing up your
> code with any clumsy, bloated or error-prone cruft, for which future
> maintainers (including yourself) will be grateful, e.g.:
>
>     repeat with adRef in ads
>         set adnumber of adRef to text 2 thru -1 of adnumber of adRef
>     end repeat
>
> is both better code and easier to read than your original sample.
>
>
> Really the only AS-specific tip I'd give is: don't try to be clever. Write
> your programs to be good code, not "good English". Well designed code that
> makes good use of functions, constants, comments, etc. is worth its weight
> in gold, and will definitely make your code more readable and easier to
> understand. Gratuitous spatterings of 'the's, stupid keyword arguments,
> inconsistent syntactic forms, etc. won't, and will just twist you, your
> code and its readers into knots.
>
> HTH
>
> 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:
> rdtimes.com
>
> This email sent to email@hidden
>
>

 _______________________________________________
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

  • Prev by Date: Merge PDFs
  • Next by Date: Re: Folder Actions Dictionary
  • Previous by thread: Re: Scripting stylistic question
  • Next by thread: matching strings with accented characters
  • Index(es):
    • Date
    • Thread