• MacTech Network:
  • Tech Support
  • |
  • MacForge.net
  • |
  • Apple News
  • |
  • Register Domains
  • |
  • SSL Certificates
  • |
  • iPod Deals
  • |
  • Mac Deals
  • |
  • Mac Book Shelf

MAC TECH

  • Home
  • Magazine
    • About MacTech in Print
    • Issue Table of Contents
    • Subscribe
    • Risk Free Sample
    • Back Issues
    • MacTech DVD
  • Archives
    • MacTech Print Archives
    • MacMod
    • MacTutor
    • FrameWorks
    • develop
  • Forums
  • News
    • MacTech News
    • MacTech Blog
    • MacTech Reviews and KoolTools
    • Whitepapers, Screencasts, Videos and Books
    • News Scanner
    • Rumors Scanner
    • Documentation Scanner
    • Submit News or PR
    • MacTech News List
  • Store
  • Apple Expo
    • by Category
    • by Company
    • by Product
  • Job Board
  • Editorial
    • Submit News or PR
    • Writer's Kit
    • Editorial Staff
    • Editorial Calendar
  • Advertising
    • Benefits of MacTech
    • Mechanicals and Submission
    • Dates and Deadlines
    • Submit Apple Expo Entry
  • User
    • Register for Ongoing Raffles
    • Register new user
    • Edit User Settings
    • Logout
  • Contact
    • Customer Service
    • Webmaster Feedback
    • Submit News or PR
    • Suggest an article
  • Connect Tools
    • MacTech Live Podcast
    • RSS Feeds
    • Twitter

According to Script:
Vocabulary Advice

Cal Simone

One of the beautiful things about AppleScript is that it allows you to do nearly anything you want in your vocabulary; however, just because it allows something doesn't mean that you should do it. To help guide you, I'll regularly include miscellaneous pieces of vocabulary advice in this column. This time I'll address words to avoid in your vocabulary. Here are a few examples:

  • Avoid using object as the name of a class. If you must implement an abstract object class, use base class.

  • Avoid using the word of in your terms. It tends to be confusing, since it's used between parts of an object specification. It may not always possible to avoid this, but think carefully before doing it.

  • Avoid using end as the first word of a verb name.
Let's look more closely at the problem with using end. Keep in mind that users are accustomed to seeing end at the end of a block, and AppleScript automatically appends the word tell, repeat, if, or the name of the handler after the word end if the user types end on a line by itself. For example:
if the moon is blue
...
end [if] -- AppleScript fills in the "if"
If you use end as part of a verb name in your vocabulary, such as end animation, users will type the word end by itself and expect AppleScript to fill it in. Of course, this won't happen for a dictionary-defined command like end animation, which isn't a true block construct, so it will appear that the AppleScript compiler is behaving arbitrarily.
begin animation
...
end -- AppleScript doesn't fill in "animation"
This confusion already exists in the case of the Database suite event End Transaction. In dictionaries of applications that support transactions, users find themselves having to remove the word transaction in the phrase end transaction whenever they recompile a script. Don't create this confusion in your vocabulary -- it's better to use verb names like start animation and stop animation. Users will assume that the full verb name is required.
start animation
...
stop animation

CAL SIMONE (mainevent@his.com) plans to include this advice in one of his future According to Script columns in develop. We're putting it on the CD and develop's Web site so you won't have to wait for this valuable information.*

 
MacTech Only Search:
Community Search:

 
 
 

 
 
 
 
 
  • SPREAD THE WORD:
  • Slashdot
  • Digg
  • Del.icio.us
  • Reddit
  • Newsvine
  • Generate a short URL for this page:



MacTech Magazine. www.mactech.com
Toll Free 877-MACTECH, Outside US/Canada: 805-494-9797
MacTech is a registered trademark of Xplain Corporation. Xplain, "The journal of Apple technology", Apple Expo, Explain It, MacDev, MacDev-1, THINK Reference, NetProfessional, Apple Expo, MacTech Central, MacTech Domains, MacNews, MacForge, and the MacTutorMan are trademarks or service marks of Xplain Corporation. Sprocket is a registered trademark of eSprocket Corporation. Other trademarks and copyrights appearing in this printing or software remain the property of their respective holders.
All contents are Copyright 1984-2010 by Xplain Corporation. All rights reserved. Theme designed by Icreon.
 
Nov. 20: Take Control of Syncing Data in Sow Leopard' released
Nov. 19: Cocktail 4.5 (Leopard Edition) released
Nov. 19: macProVideo offers new Cubase tutorials
Nov. 18: S Stardom anounces Safe Capsule, a companion piece for Apple's
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live