PDA

View Full Version : I want to make Cocoa apps--which language?




jamdr
Oct 9, 2005, 05:44 PM
I should start by saying I don't want to bother learning Obj-C. I'm sure it's a great language and everything but I primarily use Java and C++ and platform portability is important to me. I just don't see the point of learning another C-variant language when it's only used on a single platform. I was going to try out Cocoa-Java but apparently Apple has discontinued it since Tiger. Where does that leave me?

Basically I just want to be able to use IB for my GUIs ;)

Someone recently made me aware of something called AppleScript Studio, which lets you build full-fledged applications with AS! Well, I used to use AS all the time back in the days of OS9 so I don't think I'd have to learn a whole new language (unless it's changed that much). The kinds of applications I'm going to be developing are pretty simple, but it's absolutely necessary for me to have solid XML support. Does ASS have a good XML parser built-in? Thanks for your help.



robbieduncan
Oct 9, 2005, 05:56 PM
Learn Obj-C. It takes 2-3 hours if you can already write C.

ASS is a little slow and does not have access to everything that you can access through Obj-C.

You could start off with ASS and then move on to Obj-C I suppose. Cocoa-Java still works, it's just unlikely to get access to some of the funkier new stuff like CoreData...

jamdr
Oct 9, 2005, 06:06 PM
Learn Obj-C. It takes 2-3 hours if you can already write C.

ASS is a little slow and does not have access to everything that you can access through Obj-C.

You could start off with ASS and then move on to Obj-C I suppose. Cocoa-Java still works, it's just unlikely to get access to some of the funkier new stuff like CoreData...
Yeah, I knew someone would say that. It is just my understanding that Obj-C is like C++ but worse. When I look at Obj-C code it just looks like a mess and it is not obvious to me at all what everything does. If ASS is slow maybe I can just use C with Cocoa? Is this difficult to do?

logicat2001
Oct 9, 2005, 10:51 PM
It is just my understanding that Obj-C is like C++ but worse. When I look at Obj-C code it just looks like a mess and it is not obvious to me at all what everything does.
Well, you'd be missing out if you believe that it's confusing just because you haven't learned it yet. That's to be expected. Most every code style is confusing until you glean it's purpose.

Obj-C is a strict superset of C. Everything you've learned in C is available to you. However, Obj-C's object syntax allows for some of the most readable code, IMHO. Couple that with the Cocoa frameworks and you get tremendous functionality in an elegant set of frameworks. I absolutely love it and am really enjoying coding again.

If you're comfortable coding in other languages, I invite you to dig in for a week or two. I can't imagine your confusion will last very long.

Best,
Logicat

satans_banjo
Oct 10, 2005, 01:57 AM
there's also the fact that applescript studio is a commercial product that you have to pay for, whereas xcode and interface builder are bundled with OS X

robbieduncan
Oct 10, 2005, 02:27 AM
there's also the fact that applescript studio is a commercial product that you have to pay for, whereas xcode and interface builder are bundled with OS X

No it's not. ASS is bundled with XCode.

devman
Oct 10, 2005, 04:26 AM
Yeah, I knew someone would say that. It is just my understanding that Obj-C is like C++ but worse. When I look at Obj-C code it just looks like a mess and it is not obvious to me at all what everything does. If ASS is slow maybe I can just use C with Cocoa? Is this difficult to do?

Well I guess you'd have to define "worse."

As far as looking like a mess - I'm surprised how this comment comes up from time to time. There's no real syntactic sugar or ugliness in Obj-C. The major difference is in the syntax for method calls.

But, frankly this is all missing the big picture. If you want to do Cocoa development for OS X then Obj-C is the only place to be.

devman
Oct 10, 2005, 04:45 AM
I should start by saying I don't want to bother learning Obj-C. I'm sure it's a great language and everything but I primarily use Java and C++ and platform portability is important to me. I just don't see the point of learning another C-variant language when it's only used on a single platform. I was going to try out Cocoa-Java but apparently Apple has discontinued it since Tiger. Where does that leave me?

Basically I just want to be able to use IB for my GUIs ;)

Someone recently made me aware of something called AppleScript Studio, which lets you build full-fledged applications with AS! Well, I used to use AS all the time back in the days of OS9 so I don't think I'd have to learn a whole new language (unless it's changed that much). The kinds of applications I'm going to be developing are pretty simple, but it's absolutely necessary for me to have solid XML support. Does ASS have a good XML parser built-in? Thanks for your help.

What do you mean by platform portability? If you mean the app then Cocoa and AS are out of the picture. You'd go with 100% pure Java.

If you mean just your language skills, well AS is also just as single paltform.

Doesn't make sense.

If you're already proficient with Java and C++ then robbieduncan is right - you'll pickup Obj-C in 2-3 hours. There's little syntactical difference. All your time will go to learning Cocoa and the other OS X frameworks.

robbieduncan
Oct 10, 2005, 05:20 AM
The kinds of applications I'm going to be developing are pretty simple, but it's absolutely necessary for me to have solid XML support. Does ASS have a good XML parser built-in? Thanks for your help.

Just noticed this direct question. If you are going to be working with XML a lot then Java is probably a good fit. As far as I am aware ASS does not handle XML very well at all. You'd probably want to call across the bridge into Obj-C for this!

kanaka
Oct 10, 2005, 05:37 AM
I agree with everyone else... if you want to make an app for Mac OS X, Objective-C is the way to go. I think it's far simpler than C++.

Objective-C looks a bit funny at first because you use brackets to make a method call instead of "->", but you'll get used to it quickly. There are a few memory management differences, but those aren't too tricky either.

And Objective-C has nifty dynamic runtime binding.

AlmostThere
Oct 11, 2005, 09:13 PM
Have a look at Python / PyObjC.

1. It is a very useful language in itself and will complement your C++ and Java. It is vary easy to pick up, too and is pre-installed on OS X.

2. The language has bindings for hundreds, if not thousands, of libraries and APIs (including several xml modules, both built in and optional extensions). Examples (I have personally used in the last month) include Linear Algebra, OpenGL, CGI, MySQL, Image Processing and Libxml2.

3. It has superb Cocoa bindings, including (nearly) all of the latest features, in Apple's own words: "Today, you can build native, uncompromising, best-of-breed Mac OS X applications using only Python"link (http://developer.apple.com/cocoa/pyobjc.html).

4. As it is developed out of (Apple's) house, being a sourceforge project, and pre-dates OS-X, it is extremely unlikely to be dumped.

5. Development is much faster than with ObjC.

And probably some other stuff, too, like Jython (integration of Python into Java) if Java floats your boat ;)

It is not without drawbacks:
Integration into Xcode (or other IDEs) is not that great.
You need to reference Java or ObjC documentation.
Obviously processor intensive tasks take a hit with an interpreted language (Python can easily wrap your own C or C++ code).

And probably some other stuff here, too.

You might also want to look at Ruby, which again has Cocoa binding but I am in no position to comment on those.

0.02 on ObjC: if C++ to you means mostly polymorphism, you will be fairly happy and can enjoy the (imho preferable) function calling syntax. If C++ to you means templates and strong typing, then you might be in for a shock. I use C++ mostly with shallow class hierarchies and lots of templates and have no doubt at all in saying that ObjC has more in common with Python that C++. YMMV, as they abbreviate.

devman
Oct 12, 2005, 12:52 AM
0.02 on ObjC: if C++ to you means mostly polymorphism, you will be fairly happy and can enjoy the (imho preferable) function calling syntax. If C++ to you means templates and strong typing, then you might be in for a shock. I use C++ mostly with shallow class hierarchies and lots of templates and have no doubt at all in saying that ObjC has more in common with Python that C++. YMMV, as they abbreviate.

Excellent points re: C++. In fact, the dynamic-runtime model vs static-strongly typed applies to anyone coming from Java too (yes, I know about Class.forName and etc.).

caveman_uk
Oct 12, 2005, 02:41 AM
Excellent points re: C++. In fact, the dynamic-runtime model vs static-strongly typed applies to anyone coming from Java too (yes, I know about Class.forName and etc.).
I came to objective-C from a procedural, strictly typed programming background so OO took a while to get my head around and I still pretty much type everything as strictly as I can (if only for code completion purposes) but there are times when dynamic typing is a real godsend.

Fukui
Oct 12, 2005, 02:49 AM
I should start by saying I don't want to bother learning Obj-C. I'm sure it's a great language and everything but I primarily use Java and C++ and platform portability is important to me. I just don't see the point of learning another C-variant language when it's only used on a single platform.
You can use obj-c in Linux, and Windows with GNUStep.

Obj-C is not another variant of C, IT IS C.
Objective C "objects" are just structs with methods that are just pointer to functions... [object doSomething] just evaluates to objc_msgSend()...

If you already know C++ and Java, Obj-C will take you less than 30 min to get. Why don't you read the Objective-C manual, it'll take you less the 30 min to get through and come back and see if you still want to use C++ (which you can by the way in Obj-C++).

P.S Its not Obj-C you should be worried about learning, its the Cocoa APIs