Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Apple use Objective-C?

Why did Apple decide to use Objective-C for the iPhone SDK and not C++?

It seems strange to me that they would not have chosen a language more popular than Objective-C. Is it because wanted to have something unique in their application which is not otherwise in general use?

like image 369
rkb Avatar asked Jul 29 '09 19:07

rkb


People also ask

Why does Apple still use Objective-C?

Adoption of Swift by third-party developers is high, but much of Apple's operating system still uses Objective-C. Of course, much of Apple's reason to continue using Objective-C code within its operating systems is that it's legacy code which is still functional.

Does Apple own Objective-C?

In 1995 a failing Stepstone sold the total rights for Objective-C to NeXT, which then went to Apple when it acquired NeXT in late 1996.

Does Apple use Objective-C or Swift?

As far as Apple is concerned, Swift is the future. But Apple isn't oblivious to the fact that hundreds of thousands of applications and thousands of open source libraries are written in C and Objective-C. The company very well knows that Objective-C will be around for many, many years to come.

Is Apple getting rid of Objective-C?

When Objective-C migration is perfect and developers beg managers for permission, Apple will say, "You should really be using Swift", and discourage Objective-C. Years later, it may be deprecated, but it never will be removed. It powers iOS, and years after deprecation OS X still runs bits of Carbon.


2 Answers

Apple merged with NeXT in the '90s and Mac OS X was made from NeXT's operating system, NeXTSTEP. Objective-C was the official language of NeXTSTEP's application frameworks, which became Mac OS X's Cocoa. Mac OS X was then adapted into the iPhone OS, and Cocoa was made into Cocoa Touch. Objective-C has held up pretty well all along the way, and a lot of Cocoa's features would be difficult to translate into C++.

So essentially, it all comes from NeXT.

like image 185
Chuck Avatar answered Sep 24 '22 12:09

Chuck


Objective C began life in 1983 I believe, created by Brad Cox and Tom Love. The idea of Objective-C was to take the purity and low-level control of C and merge that with true object-oriented features that would allow companies to customize system libraries that could communicate with the OOP layer of Obj-C. Essentially, it worked. Obj-C is a strict superset of C, unlike C++ which is most of C, but with many differences.

When Steve Jobs founded NeXT Computer (1985), he brought in some of his former Apple team and others. His best programmers were interested in using a language that expanded on C with the same speed benefits and system control. They chose Objective-C. NeXT eventually wrote many libraries and methods for the base language. These all begin with NS for Next Step. This was the name of the NeXT OS. By 1989 the Next Step OS was considered to be vastly superior to MS Windows or Mac OS, and many computer companies wanted to license it badly. Jobs simply didn't want to go in that direction.

Once Apple wised up and brought Steve Jobs back into the fold (1996), the infusion of Next Step OS into the new Mac OS X was really the key to Apple reviving its software and its programming strategy.

While C++ remains a truly excellent and powerful language, I find that Objective C has less flaws (just my opinion), and Apple's continued work on Cocoa libraries has made the Obj-C language a truly modern power with C underpinnings. Is it better than Java? Not sure. But for what it is primarily designed for (Mac OS, iOS) it is astonishingly good, if a bit overly verbose.

The greatest criticism of Obj-C is the syntactical styling, but any programmer that truly learns the language will quickly learn of its amazing power and seemless fit with all things Mac, iPhone, iPad.

Will any other platforms ultimately adopt Obj-C? not sure, but doubtful. But the Cocoa libraries are truly wonderful.

like image 29
Jonathan Willis Avatar answered Sep 20 '22 12:09

Jonathan Willis