views:

2849

answers:

17

Do I really have to learn Objective-C to develop solid Mac Apps?

As Mac users tend to use only applications that have a nice (native) GUI, i don't think that Mono and GTK+ or any Java GUI (Swing) will fit their needs.

There are projects like Cocoa#, PyObjC and RubyCocoa, but are they ready for primetime?

So do I really have to learn Objective-C ? I would prefer a dynamic language.

+29  A: 

Objective-C is a dynamic language, as far as the Objective-C parts go. Here's a little summary article: http://www.macdevcenter.com/pub/a/mac/2003/04/28/objective-c.html

The syntax is scary at first, but it grows on you. I suggest biting the bullet and slogging through it.

If you want to work at a "real job" doing Mac programming with other people, you're going to need to know Objective-C (in my opinion, anyway).

Mitch Haile
Objective-C is actually really good. I've been developing in C# since its inception so Objective-C was a hurdle at first, but I've really come to like it.
cfeduke
As for the square brackets, this might be helpful: http://stackoverflow.com/questions/142476/do-i-have-a-shot-at-learning-objective-c/142636#142636
OscarRyz
+12  A: 

I think the short answer is yes, you need to learn Objective-C.

The Python and Ruby "bridges" work, but it's not what Apple is pushing or using itself. A few years ago there was a Java bridge to Cocoa but that's now deprecated. Who knows what will happen to the non-ObjC languages?

In any case, Objective C is pretty dynamic. Not in the way that Ruby/Python are perhaps, but it's certainly not like C++.

Stephen Darlington
This may not have been the case when this answer was written (I don't remember), but Podcast Producer on Mac OS X Server is written in Ruby.
Jonathan Sterling
+12  A: 

Short answer: YES :)

OscarRyz
Longer answer: YES, and if you try to avoid it you will only cause pain to yourself and your users.
NSResponder
+5  A: 

You definitely need to learn Objective-C even if you choose to use one of the bridges. Apple has already shown by their treatment of Java that they're not really interested in providing huge amounts of support or backwards compatibility to the use of Cocoa through anything but Objective-C.

So use one of the bridges, if you like, but have a firm grasp of the Objective-C runtime and the bridges so that you can manage them yourself, if need be.

David Mitchell
+1  A: 

Short answer is yes, longer answer is "you can use Objective-C++." Either way you're going to have to learn at least some of Objective-C. Once you start digging into Cocoa (the framework for building Mac OS X apps), the Xcode tools, and the Apple Human Interface Design guidelines, you'll realize that Objective-C is the way to go.

Robert S.
+1  A: 

Not only you have to know Objective-C (the easy part), you must be very comfortable with plain old C. That's in my opinion the biggest challenge for most people.

Sergio Acosta
I don't think that you need to know any of the "hard" stuff in C to be an effective ObjC programmer. For most applications if you're using pointers and C strings, you're probably doing it wrong! Having said that, knowing C can certainly make you a better ObjC programmer.
Stephen Darlington
in my book, if you're not comfortable with pointers, you have to right to call yourself a C programmer, and that includes Obj-C and C++
Javier
If you mean that you need to know the the basic c statements like "for" and "switch" I agree, but if you are talking about pointers, I disagree.
lajos
You need to understand pointers and C-magic of that sort in order to understand the workings of the Objective-C runtime, one of the most interesting things about programming in Cocoa or other Objective-C platforms. You may not think you need it, but your mind will a-splode with happiness every time you know that you understand how all this smalltalk-y magic is actually implemented.
Jonathan Sterling
+1  A: 

If you already know C, Objective-C is pretty easy to learn.

Ruby and Python are both viable for "real" Mac apps. ADC has a few articles on the topic. MacRuby looks like it will be replacing RubyCocoa.

I would still recommend learning Objective-C though. Most of the example code you find will be in Objective-C and the books tend to be Objective-C (though the Pragmatic Programmers have a RubyCocoa book in the works. Most Cocoa apps are written in Objective-C.

And Objective-C is dynamic. Take a closer look at it, it isn't nearly as intimidating as people think. It's Cocoa that tends to have the steeper learning (or unlearning) curve.

Terry Wilcox
A: 

In general yes; but even if you (correctly IMHO) ruled out Mono, GTK and SWING because they don't fit well in the GUI, try Qt. it's REALLY respectful of Mac GUI standards (HIG: Human Interface Guidelines), and can be equally programmed on C++, Python and Java. the last version is cocoa-based and 64-bit capable.

the only thing missing from Qt that you'd get from Objective-C is those awful non-HIG-compliant modern Apple applications (yeah, Aperture and Final Cut, I'm looking at you!)

Javier
Sorry, I've never, ever seen a Qt application that actually looks like it fits in with Mac OS. It may be the fault of stupid-headed developers, but any Mac app that is remotely beautiful has not been done with Qt. To my knowledge. I'd love to be corrected on this with an example, though.
Jonathan Sterling
+3  A: 

There are a small number of successful Cocoa apps written in bridged languages, so you don't necessarily need to use it that much, but you do need to learn it. People who try to learn to write Mac OS programs in bridged languages do themselves a huge disservice. The bridged languages are great tools, but they are the sort of things that allow someone with a knowledge of the bridged language and Objective C to become extra productive, not skip learning Objective C.

In order to use something like PyObjC or MacRuby effectively you need to really have a good understanding of how the native runtime works to deal with all the impedance mismatches that can occur between the bridged language and the Objective C runtime.

Louis Gerbarg
+3  A: 

Do I really have to learn Objective-C to develop solid Mac Apps?

Currently, yes.

As Mac users tend to use only applications that have a nice (native) GUI, i don't think that Mono and GTK+ or any Java GUI (Swing) will fit their needs.

Correct.

There are projects like Cocoa#, PyObjC and RubyCocoa, but are they ready for primetime?

Cocoa#: I don't know, as I don't use C#.

PyObjC: Sort of, but Cocoa in Python is a bit of a hack, since Python isn't Smalltalky enough.

RubyCocoa: Maybe. I'm waiting for MacRuby to mature, though. See also:

Peter Hosey
Yeah, don't mess with RubyCocoa. MacRuby is coming along really nicely. Especially hotcocoa.
Jonathan Sterling
A: 

No you don't have to learn cocoa however it is worth looking at because it is an incredibly powerful api and very well documented, if you already know C then its very easy (honestly it is - i know it looks daunting syntactically).

The problem with the bridged approach on OS X is it seems to be very immature and only really designed for people who are prepared to read the documentation associated with the main cocoa api.

In all honesty if you know c you will pick up the basics of obj-c with a book, the one by Arron Hilligas (spelling?!?!) is superb.

PixelSmack
A: 

If you try hard enough, you can go about producing software without using Objective-C that has the potential to be great except for the fact that at the end of the day it won't be very good. You will spend more time trying to harangue a language into doing something that it isn't the absolute best at. At WWDC I wore a shirt that said "Learn Objective-C or Retire" which didn't go over too well with some people who still held dearly onto the last threads of Pascal's life, but the point is altogether true - Objective C is where it's at on the Mac and to pretend otherwise is to do yourself a disservice.

Having said that, you should definitely not rule out the bridges on the platform for extending your application - Bill Bumgarner is quick to point out how much power the Twisted networking framework provides to Cocoa applications via the PyObjC bridge.

wisequark
+7  A: 

Our first app was built in Python, using the PyObjC bridge. From experience I can tell you that to build an application with a bridge you need to learn:

  1. The idiosyncrasies of the bridge
  2. To read and write code in the bridge language (Python in my case)
  3. To read code in Objective-C (All useful sample code is in Obj-C)
  4. To write pseudo-code in Objective-C (if you ever want to ask questions on a mailing list or likewise)
  5. Cocoa

Of all those things to learn, Cocoa is the biggy. It's where the really interesting stuff comes in and the thing you really need to wrap your brain around. After working on this PyObjC project, it's become pretty easy for me to code in Obj-C, even though I had no prior experience coding in C.

So my advice is: Focus on learning Cocoa, and use the language that's most suited as a tool to do that (Obj-C). If you ever find a particular reason to use a bridge, such as having a need for an ORM that can deal with networked SQL, etc. you can apply around 90% of what you learned writing your first Obj-C/Cocoa app(s) in the bridged project.

Finally: I don't really understand the resistance many people who're new to the platform have to learning Objective-C. Isn't it exciting and gratifying to learn new stuff and build the best possible things armed with this new knowledge?

Dirk Stoop
Us ex-Newton developers are spoiled - XCode/ObjC just seem really cumbersome compared to NTK/NewtonScript.
glenra
Frankly, I think Objective-C is hard to like. I've learned Objective-C, and I don't like it at all. The more I use it the less I like it. I'm interested in moving from Objective-C to Python (which I find more productive and fun).
Nosredna
A: 

Not programming in a scripting language turns out to not be so bad when you're using XCode. The GDB integration is very good; I'm primarily a Perl guy, and I find the XCode debugger very nice and very easy to use.

The "fix" feature will really surprise you with how usable it is. Imagine finding a bug in your ObjC code, fixing it, and then telling the debugger to continue on. It actually works in a lot of cases.

Try ObjC. You may find you like it a lot better than you think you will.

Joe McMahon
A: 

"have to", well... technically, no.

Since most Mac app jobs are done thro ObjC (for a very good reason I might add), I wouldn't kid yourself and learn it.

Rev316
A: 

Hell no. You can use a number of languages to make a nice GUI with. It just depends on what's the usual/easiest solution for the platform. In Mac OS X's case, Objective-C and AppKit are pretty easy to use choices. However, I use REALBasic sometimes, and that allows cross platform development (and, of course, a performance hit).

So really it depends on how much work you want to put into it. You should learn Objective-C if you want to really do serious Mac development. But you can get by without it....

A: 

I am a mac user too. I will use an application which written in java if it is useful. For example Netbeans is a nice IDE and the GUI is swing.

bcursor