Mason Hale, in a message he posted to the Mac Scripting list a few months ago during one of the "AppleScript vs. Frontier" threads.
Since I have used AppleScript heavily for CGIs and other tasks and have since taken up using Frontier - I thought I would step into the crossfire and give my perspective on the two environments.
Though Frontier is more powerful, AppleScript holds an important place in the Macintosh scripting world. Like a lot of people have said, AppleScript is a better choice for simple scripts in situations where memory is tight. Or for distribution to people who would have no use for installing Frontier. Or for people with little or no programming background who want to get started quickly and aren't real concerned with performance.
Many people have described Frontier as being much more difficult to learn than AppleScript. It is more accurate to say that Frontier is more intimidating than AppleScript. For the beginner, Frontier (especially the object database) represents a totally foreign environment.
AppleScript opens with a friendly, intuitive, and obvious script editor window. There is no question that the purpose of that window is for writing scripts.
On the other hand, Frontier opens with a very confusing message window with four buttons: "Menu Bar", "Object DB", "Quick Script" and "Tech Support". I want to write a script so I should click "Quick Script", right? Wrong. I won't go into how to create a new script (it _is_ easy) - the point is that I spent at least half an hour just trying to find the script editor when I first started with Frontier.
The difficulty I had finding the script editor doesn't mean that Frontier's UserTalk scripting language is more difficult than AppleScript. The UserTalk language is tightly integrated with Frontier's object database. It does mean that to use the language effectively *requires* grasping what the object database is and what it does.
It is this initial hurdle that confuses and frustrates beginners. But once that hurdle is cleared and the light bulb in your head flickers on - everything falls into place very nicely. All the pieces function in the same predictable way.
Many people compare UserTalk to C in terms of difficulty. This really
isn't fair. UserTalk _is_ C-like in its syntax, but that doesn't make it
difficult. C is difficult to learn, not because the syntax is hard to
follow, but because it doesn't take care of things like memory management
(or strings!) for you. Frontier does handle memory management,
multi-threading and much more. I would argue that C is so popular because
the syntax is so well suited to programming.
I would also argue that English is not well suited for use as a programming
language. I think basing the scripting language on English (or French) is
the fundamental flaw that limits its capabilities. This is where I think
AppleScript takes the lead in difficulty. Once you get beyond short simple
scripts - the idea of basing a programming language on English starts to
unravel. Ever try passing ten or more parameters to an OSAX or another
application?
tell application "Clip2GIf"
convert file sourceFile saving as GIF in file fileName with scale 100 ¬
depth 8 without transparency
end tell
Yuck! It gets to become an unholy mess. And there are longer examples. The
point is - that as the complexity of your script increases the ability to
convey what you want in AppleScript dimishes rapidly. At least that has
been my experience.
With UserTalk there is much more headroom to grow. The complexity of your
scripts doesn't increase the difficulty of the language. Everything works
the same way it did in that first "Hello World" script, the commands just
take more parameters.
I also think it is worth pointing out that if you are ever considering
learning a lower-level language like C - having previous exposure to
UserTalk makes everything look much more familiar - something AppleScript
won't do for you. That is basically where I am now, I'm learning C and am
very thankful I learned UserTalk first.
In summary if I had to graph the learning curves of AppleScript and
UserTalk I think they would look like this:
AppleScript
D +
I | =
F + =
F | =
I + ==
C | ==
U + ===
L | ===
T + =====
Y |=====
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
SCRIPT COMPLEXITY -->
UserTalk
D +
I |
F +
F |
I + ========
C | ===========
U + =======
L |====
T +
Y |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
SCRIPT COMPLEXITY -->
My conclusion is that AppleScript is easier to pick up and use right away,
but Frontier is easier to continue using as your scripts get more complex.
I really hope that people who are using AppleScript and might feel like
they are hitting some of the limits in terms of script complexity or
performance will consider looking into Frontier. Especially anyone doing
any sort of CGI development. It really is worth getting over that first
hurdle.
If you are happy using AppleScript and don't need more complexitiy in your
life, then Frontier probably isn't for you.
Sorry for yet another long post in this never ending flame war.
Happy Scripting!
- Mason
© Copyright 1996-97 UserLand Software. This page was last built on 5/7/97; 1:50:49 PM.
It was originally posted on 6/27/96; 8:59:42 AM.
Internet service provided by Conxion.