• 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: Help the shocked make a transition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help the shocked make a transition


  • Subject: Re: Help the shocked make a transition
  • From: Christopher Nebel <email@hidden>
  • Date: Tue, 1 Sep 2009 10:21:33 -0700

To me who kinda understands AppleScript enough to copy and paste bits together to make things that are useful for me it means that I am scared off. AppleScript was nice and easy to understand. When I hear "Cocoa" I think "Objective C" which means "real programming" which I don't understand, know how to do nor have any interest in learning.

Are my AppleScript days over? Or just my days of attaching a pretty UI?

OK, that nails a couple of fundamental misconceptions that have been floating around, so we'll start there.


1. Cocoa ≠ Objective-C

While Cocoa and Objective-C often appear together, they're not the same thing at all. Objective-C is a language. Cocoa is a framework, and it's a framework you can use from languages other than Objective- C, thanks to the various runtime bridges. Want to write a Mac OS X app in Python? Use Cocoa with PyObjC. Ruby? Use Cocoa with RubyCocoa. AppleScriptObjC is simply another bridge. In order to use it, yes, you have to learn Cocoa, but that's not the same thing as learning Objective-C.

2. AppleScript Studio ≠ Cocoa

The marketing line is that AppleScript Studio lets you write Cocoa apps, but that's only sort of true. You are ultimately using the Cocoa framework, but you're using it using rather different tools and techniques than everyone else does, such as event handlers ("on clicked") vs. target-action. This has two big disadvantages: one is that it effectively ghettoizes Studio users -- you can only talk to other Studio users, because people used to standard Cocoa will look at your code and go "huh?" Two is that Studio relies on a lot of custom glue code -- you can only access frameworks that Apple has provided glue for, which isn't even all of AppKit, never mind all the other Cocoa frameworks. (Yes, I know about "call method". It's fine for small bits, but it gets unmanageable real fast.) AppleScriptObjC avoids both of these problems, because it bridges at the runtime level, not the framework level. At WWDC, we showed transforming an Objective-C sample line-for-line into AppleScript, so it's still essentially readable to someone who knows Cocoa/Objective-C, and we showed using the CalStore framework from AppleScript to manipulate to- do items, which is very difficult in Studio because there's no glue for it. Using AppleScriptObjC, it's just another framework.

Let's see, other points:

a. There's no documentation.

Yes, we know. Mea culpa. We're working on it. However, keep in mind that you're using Cocoa now, so ultimately most of the documentation is the existing Cocoa framework documentation. The parts that are/ will be specific to AppleScriptObjC is a translation guide between AppleScript and Objective-C (that's what's currently in the release notes) and a transition guide from Studio to AppleScriptObjC. And some example apps, of course.

b. OMG AppleScript Studio is dead OMGOMFGWTFBBQCOPTER!!!1!1!!

Take a few deep breaths, Sparky. AppleScript Studio is deprecated for new development. In other words, you technically can use it for new projects, but we'd advise against it. If you've got an existing project, the development tools still support Studio (though you will need the "defaults write" trick to turn the IB inspector back on in Snow Leopard). Deployed applications will be supported for the foreseeable future, so while you may be forced at some point to stick with a certain version of the tools, your app will still run on the latest version of the OS.

c. OMG this means they're killing AppleScript OMGOMGOMGOMGOMGOMGOMG <gasp> <thud>

Didn't I tell you to take a few deep breaths? Maybe you skipped that item. AppleScript Studio is not the same thing as AppleScript itself. AppleScript Studio is going away (slowly, see above); AppleScript is alive and well, thank you very much, or we wouldn't have bothered creating AppleScriptObjC.

d. If this is just Cocoa, why should I bother to use AppleScript instead of Objective-C?

For either of two reasons: (1) you've got a bunch of existing AppleScript code you'd like to keep; (2) you prefer AppleScript. If neither of those apply to you, then actually yes, you probably should consider moving to Objective-C. The language is not that complicated, and it's not like you need to learn all the bit-twiddling aspects of C to use Cocoa/Objective-C effectively.

e. So I have to rewrite my entire Studio app?

You have to rewrite the bits that deal specifically with Studio -- that is, your UI. The bits that do the real work, talking to Mail/ Indesign/whatever, don't need to change, though you may find opportunities to use a framework instead that you couldn't use before -- CalStore instead of telling iCal, for example. Also, we found in our experiments that, given access to Cocoa techniques such as target- action and bindings, "rewrite" often translated to "throw away" -- the AppleScriptObjC version would be shorter, sometimes much shorter, than the Studio version and even worked better.

f. So I have to learn Cocoa?

Bluntly, yes. However, a significant part of your Studio knowledge will transfer over (only parts of Studio seriously diverge from standard Cocoa, a lot of it is just adding/removing spaces), there are significant advantages over Studio, and you're allowed to not learn all of it at once.

The point of AppleScriptObjC is to put AppleScript on essentially equal footing with the other Cocoa-capable languages, so AppleScript users can share tools, techniques, documentation, and knowledge with the rest of the Cocoa world. This means some transition pain for Studio users, but we feel that the increased capabilities and power are worth it.


--Chris Nebel AppleScript Engineering

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Prev by Date: Mail.app Schedules
  • Next by Date: Re: Snow Leopard AppleScript Release Notes
  • Previous by thread: Re: Mail.app Schedules
  • Next by thread: Re: Help the shocked make a transition
  • Index(es):
    • Date
    • Thread