Hello,
For some time now, I’m using ASOC and I really like it – but I’ve got the feeling that the main challenge is not to learn the Applescript bridge itself, but how to use the cocoa framework: to find the most suitable method, its arguments and return value, and so on.
And coerce, coerce, coerce. Sometime uselessly, but “it doesn’t hurt”.
So I was wondering, as my application does not communicate with others, as the only AS part is to «set myList to files of folder XYZ» (that the File Manager does, and much more quickly), I was wondering if I could use Objective-C instead.
The reasons are:
a) use Xcode at its full capacity (type checking, compiling, debugging)
b) avoid coercion paranoia
c) get full access to cocoa (no, no, not Core Foundation as first toy)
e) develop for the iOS platform
f) be assured that my applications won’t become just garbage if Apple abandon ASOC as they did for ASStudio.
There are other signs that push me into this direction: the lack of documentation for ASOC, the fact that the answers from the ASOC MacScripters often come as Objective-C solutions (new classes or new categories), with sentences like “I don’t know if it can be done in ASOC, but I guess so”, “In Objective-C you would just write this”, and so on.
Of course, they are some disadvantages:
a) I don’t like C and its avatars. C may be efficient and widespread, it has a smell of engineering and is not really seductive, its users simply adore to play gurus with obscure shortcuts – even FORTRAN was more sexy.
b) Officially, MacScripters are. scripters, not Objective-C programmers. But I love this site and, for having looked Obj-C forums, I didn’t get the same feeling. For certain sites in french (my language), answers go even to contempt, or at best patronizing --when they come. But I could not come here to complain here if my Objective-C app goes to pieces.
Anyway. tell me if I’m wrong:
An ASOC application is, stricto sensu, a instance of a class (often NSObject). It has instance variables (properties) and methods (handlers). So far, I used only one script per application, so a unique class. I end up with something close enough from procedural programming, with a main unit, procedures and functions. and not reusable at all. So:
¢ Would it be the same in Objective-C? I mean, may my script be “converted” to an instance of an application delegate, sort of @interface MyAppDelegate : NSObject?
¢ Are my handlers convertible into methods of the only appDelegate? Everything I read show that in ObjC, you create new classes or override them very often. Instead of trying to make your table work in ASOC, using tricks to make it show your nice special cells, you “just” create a myNiceTable or myNiceCell class in a separate file and use it.
¢ For those of you who’ve switched from ASOC and Objective-C, is such a “translation” of a script possible, just to begin a new language with a working application as a basis? Is it desirable, or should I reconsider the whole model?
Any advice welcome. I am still in doubt.
Thanks!