Is Objective-C only used for development on Mac OS/iPhone?
I think ObjC has been isolated to the Apple world through a quirk of history and the nature of proprietary systems.
First, you need to separate ObjC from Cocoa. ObjC is a very primitive language. I think it is a very elegant language, but it is extremely basic. You can implement ObjCv1 in a C pre-processor. C++ and ObjC were developed about the same time. C++ put a huge amount of infrastructure in place to bring a C-like syntax to what is basically a completely different language. ObjC brought a Smalltalk-like syntax to C, with almost nothing else. Even things like +alloc
and -release
aren't language elements of ObjC. They're fairly simple wrappers around malloc()
and free()
.* Standing on its own, ObjC isn't really that interesting (elegant as I think it is). This is very similar to the nature of Smalltalk. Without its object libraries, there isn't much you can do with it. With its object libraries, it's incredibly powerful.
NeXT provided this entire framework on top of ObjC called NeXTSTEP. Since the NeXT computer was not a widespread commercial success, and NeXTSTEP was proprietary, not many people learned the framework or the underlying language. When Apple bought it, and morphed it into Cocoa, it continued to be a proprietary system.
GNUStep is out there, but they never developed anything interesting enough to bring in a lot of developers (a major web browser or word processor or the like). And Cocoa has gotten well ahead of GNUStep over the last few years. It's possible that with the rise of interest in Cocoa due to iPhone, that GNUStep may revitalize and bring a nice cross-platform development framework, but I kind of doubt it. Folks who have a background in C++ look at C# and see a clear improvement. When they look at ObjC, they see a lot of square brackets where they don't expect them. For people raised on the "calling methods" paradigm, the Smalltalk paradigm of "passing messages" is alien and even a bit scary. Many developers assume they need a strongly typed language to avoid bugs and are uncomfortable with a system that relies primarily on programmer discipline and careful consistency. It is much easier to hack something that "just works" in C# than in ObjC. ObjC really expects a lot more of the developer in understanding what's going on and not relying on the compiler to protect you from your hacks.
Basically, folks knew C from Unix, and C++ makes sense in terms of C, and Java makes sense in terms of C++, and C# is just cleaned up Java. ObjC isn't any of these. It's Smalltalk, and no one learns Smalltalk anymore.
* I recently chatted with the guy who wrote +alloc
about its history, and he might object to my calling it a simple wrapper given the inclusion of zones. So for you who know the difference, replace +alloc
here with +new
.
@Stephen: I'm constantly surprised at how people never read our website or even check on the progress of the project before saying things like this. :) GNUstep follows Cocoa closely now and we're so much more than OpenStep at this point. If you, or others, want to have a real opinion on the subject get GNUstep from SVN, install it and try it out. Pontification about something you know nothing about (as demonstrated by your response here) is pointless.
Greg C. GNUstep Lead Developer
Well, there is also the GNUStep framework that some people still develop for. I don't know how active that community is, however.
But for the most part Objective-C is now an Apple language, as illustrated by the fact that the "2.0" version of the language was launched as part of OSX 10.5 and seems to have been a purely in-house development effort at Apple.
Edit: Apple, as you probably know, has something called the Cocoa framework, which basically refers to the entire stack of libraries for Objective-C, including the NSObject common baseclass. Cocoa is a continuation of the NextStep library, which GNUStep is the open-source version of. So you'll find many of the NS-prefixed classes both places, but Apple has not held back in adding new classes or changing them in Cocoa, so interoperability at the GUI level is really only a theoretical possibility.