Converting to Objective-C

Hi All,
I’ve decided to look at converting some of my larger ASOC projects over to Objective-C, and I have a few questions regarding the process.

  1. I’m thinking I can transition over by gradually converting scripts to classes, while running and testing the conversion as an ASOC project. Then eventually I’d put all the converted classes together as an objective-c project. Does that seem like a reasonable game plan? Are there any gotchas I’ve got to watch our for. Is there a better way?

  2. Assuming the above is a good plan of attack, I’m wondering about memory management. From what I understand, ASOC uses garbage collection, so as I’m creating my classes in Xcode, I’m guessing garbage collection should be turned on??

  3. This website has been invaluable to me in my programming. Does anyone has suggestions for an equivalent site for objective-c. Stackoverflow.com has proven to be very useful for many of my questions, but it’s not very forum-like, and I’ve got a fair number of newbie questions that don’t seem appropriate at that site. Perhaps, with the rise of ASOC and more scripters needing objective-c, it’s time to add an objective-c thread here - hint, hint :).

  1. I think that’s fine, I’ve converted some of my projects that way.

  2. Yes garbage collection should be on unless you’d like to tackle memory management as well

  3. I think it’s fine to ask those questions here – there are certainly people here who can help with Objective-C, and I think that seeing the conversion process is valuable to ASOC users since it’s helpful to be able to read Objective-C code and translate back and forth. And besides, the people are nicer here. :slight_smile:

Ric

I think it would be a great to have an objective-c thread.

I dabble in objective-c and as your projects get larger there is often a need to switch to objective-c and as you say the contributors here are much friendlier than other places where to be honest I feel intimidated asking a question which does not always get a reply and often the sarcasm…

So, your suggestion, get’s my vote.

I hope the powers consider it.

Can we now call objective-c MacScripting.

All the best

Terry

I’ll ask Ray Barber (owner of this site) if he’ll consider adding an Obj-C topic, though I doubt that MacScripter is the place folks would normally head unless they were converting script-based apps.

I agree with that… Objective-C is quite different than writing a plugin in AppleScript. Also Objective-C programmers are quite comfy with mixing C in Objective-C code and even C++. So where does it end? Cocoa is not Objective-C it’s an API written in Objective-C. Then there is the second problem; maybe there are on macscripter about 10 - 20 active users who can write proper Objective-C solutions while there are hundreds maybe thousands online on cocoabuilder, cocodev and stackoverflow.

I understand DJ’s points, but I still think this is the place to further ones understanding of both ASOC and Objective-C. It’s hard to understand the power of ASOC without knowing how to read Objective-C examples and docs. Also, being able to add some Objective-C classes to do things that can’t be done in ASOC (or for performance reasons) and to add categories onto Objective-C classes can really help an ASOC app. We shouldn’t have to rely on Shane writing things like Myriad Helpers to use all of cocoa. I think quite a few people would be interested in easing into Objective-C through ASOC, and if that’s the spirit of the questions here, I think that should fall within the purview of this thread – I don’t think we need a separate thread to take that on. Certainly, some people have already been posting Objective-C code here. If, over time, there was getting to be too much objective-C relative to ASOC, then that would be the time to make a new thread or for those users to move on to cocoabuilder, cocodev, etc.

Ric

And if you are going to turn off memory management, you can’t do it in stages – it’s all or nothing.

That’s a valid argument. However, I think there’s room for (a) dealing with issues relevant to the ASObjC → Objective-C transition (especially places where Objective-C solves otherwise intractable problems, or solves performance issues), and (b) doing it in a more friendly manner that accepts that the questioner is probably not as comfy mixing in things like C.

There are some great coding resources out there, but boy, do some of them come with attitude…

It’s the friendliness here that makes me wish I can stay here for my objective-c questions. When I wrote that I had newbie questions that I didn’t think were appropriate at objective-c/cocoa sites I’ve consulted for help, by “appropriate”, I really meant that the sites I’ve run into didn’t seem very newb friendly. That has never been the feeling here and I’m sure I’ve asked questions that have caused a few eyes to roll. I don’t think I’ve ever encountered any attitude.

The request for an objective-c thread (or is it topic?) was more wishful thinking than anything, but the more I think about it the more sense it would make. It wouldn’t have to be geared towards the advanced coders. They could refer to the sites with attitude :). It would be more of a transition from ASOC to OBJC - objective-c/cocoa for scripters (not experienced c,c++ programmers). Because you really do need a pretty good understanding of objective-c and cocoa, to program well with ASOC. I never really apprecaited just how true this is until now. Even something as simple as truly understanding Apples extensive documentation was difficult until now. And I’m guessing that there are other scripters like me who would either like to learn how to transition some projects over completely to objective-c or create their own classes, like Shane’s helper classes, to expand the capabilities of their ASOC projects.

That’s my 2 cents worth. Also, re-asking one of my original questions, any good cocoa/objective-c forums out there?