Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between Objective-C and Cocoa?

I'm just learning Objective-C/Cocoa programming for the Mac. All of the tutorials, books, blogs, podcasts, etc. I've been using really cover the two together. Is there an easy way to tell which pieces are vanilla Objective-C and which come from Cocoa?

like image 268
Pat Notz Avatar asked Jan 12 '09 16:01

Pat Notz


People also ask

Is Cocoa Objective-C?

In OS X, Cocoa has two core Objective-C frameworks that are essential to application development for OS X: AppKit. AppKit, one of the application frameworks, provides the objects an application displays in its user interface and defines the structure for application behavior, including event handling and drawing.

What is difference between Cocoa and Cocoa Touch in iOS?

Both Cocoa and Cocoa Touch include the Objective-C runtime and two core frameworks: Cocoa, which includes the Foundation and AppKit frameworks, is used for developing applications that run on OS X. Cocoa Touch, which includes Foundation and UIKit frameworks, is used for developing applications that run on iOS.

Does Xcode use Objective-C?

In 1996 Apple overtook NeXT, which developer tools would use Objective-C. These tools were later included in Xcode. That's how Apple began using Objective-C for Mac OS X development. As a result, Objective-C became the first choice language for everybody who wanted to create an application for OS X and iOS.

What is the Cocoa framework?

The Cocoa frameworks. The classes in Foundation provide objects and functionality that are the basis, or “foundation,” of Cocoa. The classes in Application Kit furnish the objects and behavior that your users see in the user interface, such as windows and buttons, and handle their mouse clicks and key presses.


2 Answers

Objective-C is the language... it defines all the things like the keywords for defining objects, the syntax for messaging object, things like that.

Cocoa is a development framework (it's actually an umbrella framework which combines three other frameworks, Foundation, AppKit and CoreData).

These frameworks (Cocoa) define all the objects that are nice to use and interact with the operating system, as well as a number of functions. For example, Cocoa defines things like NSString and NSObject. Cocoa can currently be used with other language bindings, such as python or ruby, and used to be used with Java as well. So, if you were using Cocoa with Java, you would still get an NSString object, but you would call and use it from within a Java application.

Without linking to one of the Cocoa frameworks, Objective-C comes with only a very basic Object class as a pre-defined root class.

like image 145
Jason Coco Avatar answered Sep 21 '22 10:09

Jason Coco


Objective-C is the language itself.

Cocoa, formerly NextStep, is the API and runtime that sits on top of Obj-C. Anything starting with NS (for NextStep) is part of Cocoa, not part of the language.

like image 30
igowen Avatar answered Sep 23 '22 10:09

igowen