Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Objective-C only used for development on Mac OS/iPhone? [closed]

I don't know Objective-C but to me it appears a nice language. But the only context I know it from is everything Apple. But Objective-C is even in the GNU Compiler Collection.

Is there something missing in the open ones? Or is there already a broader base for Objective-C? I'm interested if there are companies that chose Objective-C to develop their products.

like image 738
Norbert Hartl Avatar asked May 17 '09 14:05

Norbert Hartl


People also ask

Is Objective-C used outside of Apple?

To date, users have downloaded over 140 billion apps to their iPhones. ¹ The iPhone's success is tied to its ecosystem of third-party apps. When the App Store debuted in 2008, all apps were written in a programming language that few outside the Apple community had ever used: Objective-C.

Why is Objective-C used for iOS?

It's because Objective C has been the de facto language for Mac OS X development before it was Mac OS X. When Jobs left Apple to set up NeXT, the language Objective C was developed as a specific language that wasn't C++ and avoided many of its pitfalls.

What do you use Objective-C for?

Objective-C is general-purpose language that is developed on top of C Programming language by adding features of Small Talk programming language making it an object-oriented language. It is primarily used in developing iOS and Mac OS X operating systems as well as its applications.

Can you still make iOS apps with Objective-C?

Objective-C Because it was developed in 1984, it has had the time to mature as a language and is considered more stable than Swift. Since it is the longtime programming language used by Apple up until 2014, it is still widely supported for both iOS and macOS development.


1 Answers

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.

like image 78
Rob Napier Avatar answered Sep 22 '22 03:09

Rob Napier