Friday, February 22, 2019

#1 2019-02-11 10:12:40 am

GG
Member
Registered: 2019-01-14
Posts: 89

Is there a recommended style guide for AppleScript and AppleScriptObjC

I'm trying to "standardize" my way of coding on the Mac.

In many languages there are style guides that address coding structure and variable naming conventions etc. These guides, being style guides, are always "on top" of any restrictions imposed by the language itself. Is there such a guide for working with AppleScript and AppleScriptObjC? The AppleScript Language Reference doesn't give me much guidance beyond what is "lexically" acceptable in the language.

If not, is there a defacto one that has been adopted from another language, like C?

Offline

 

#2 2019-02-11 10:03:51 pm

technomorph
Member
Registered: 2017-12-14
Posts: 96

Re: Is there a recommended style guide for AppleScript and AppleScriptObjC

Shane Stanley's book provides some good insights.
I believe there is some guides on Apples Website.
Also just reviewing these forums often folks will chime in
On some proper syntaxing, formatting etc.
And on tre flip side you find conflicting conventions.

I've found it's taken my own Mistakes to help me learn.
Camelcasing my variables was a big one.

I've also found with OBJC that there are many different ways
To format your syntaxing with square bracketing, dot syntaxing etc.
The thing about AppleScript is that it has the ability to provide
Your own scripting dictionary definitions. So you can come
Up with your own way to "word" your code.
Apples site has some AppleScript keyword restrictions to check out.
And then you may run into conflicts with certain frameworks that
Conflict with AppleScript's Standard Additions and have to pipe some
Variables.

Explore Script Debugger's dictionary.
Explore Xcode's documentation for frameworks,
Mainly foundation.

Best thing is Everyday AppleScript OBJC from shane

Offline

 

#3 2019-02-12 12:48:34 pm

GG
Member
Registered: 2019-01-14
Posts: 89

Re: Is there a recommended style guide for AppleScript and AppleScriptObjC

Hi technomorph;

Thank you for your suggestions. I do have "Everyday AppleScriptObjC" from shane (that's good).
Since no real published standard exists, that should do as a good guide to the structuring of the code. I take it that the variable naming conventions in the book, are likely a good "go-by" as well.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)