Fog Creek Software
Discussion Board

What is "Cocoa" for Macs?

What is "Cocoa" for Macs?  Is it like COM or something?

Monday, November 24, 2003

Again, a simple google search (or a search of Apple's website) would give a whole bunch of usefull info...

Per the Apple developer website:
"The Cocoa application environment is designed specifically for Mac OS X-only native applications. It is comprised of a set of object-oriented frameworks that support rapid development and high productivity. The Cocoa frameworks include a full featured set of classes designed to create robust and powerful Mac OS X applications. The object-oriented design simplifies application development and debugging.

Cocoa provides developers starting new Mac OS X-only projects the fastest way to full-featured implementations. Applications from UNIX and other OS platforms can also be brought to Mac OS X quickly by using Cocoa to build state of the art Aqua user interfaces while retaining most existing core code."

Monday, November 24, 2003

Cocoa is a set of frameworks containing a set of classes that provide a lot of power in very convenient forms.  These classes are relatively limited in number but are feature rich - and they offer a lot of code for free (this is probably the most highly touted feature of Cocoa).

One can get right to coding and not have to worry about creating windows and text areas or handling text formatting.  One can let Cocoa handle menus and saving to PDF and handling Drawers and widgets.

That sounds a bit like VB, but Cocoa really lets you handle things more elegantly and offers more power than VB.

Cocoa is typically accessed by Objective-C; Objective-C is a superset of C offering OO programming in a manner generally consistent with SmallTalk.  In that way code is really just passing messages to objects that can handle the incoming message.  It is a very convenient language and relatively easy to pick up.

Cocoa is also accessible from Java (wow!).  You could have a natively compiled Java program accessing the Cocoa frameworks and taking advantage of all the effort that exists in that code.

Essentially Cocoa lets you write very little code to get your program up and running.  I have had some programs that I consider relatively complicated (to me, the Objective-C power is weak with me ATM) up and running in 10 minutes.  The interface is built and wired and data is populating and interface elements are updating themselves and the documents are saving to PDF or PNG.  All in all its pretty sweet.

Monday, November 24, 2003

Cocoa is one of the OS programming frameworks for Mac OS X. It would be analogous to the Microsoft Foundation Classes in the Windows world (although in function only -- not in form). A lot of people think that Cocoa is one of the best programming frameworks for any operating system, because it is well-organized, well-documented, and is fairly powerful while also being "easy to use". Of course, it can only be used to create programs that run on Mac OS X.

P.S. to RocketJeff: What is the big deal about asking a simple question on this board? Many times, all you get from a google search is a bunch of marketing gibberish (like what you just re-gurgitated in your reply). The thing that makes this forum so much better than other places on the web is that you usually get the filtered answers to questions from intelligent people that are working in the same context as you, instead of having to wade through a bunch of noise.

Jordan Lev
Monday, November 24, 2003

Intelligent, well thought out questions deserve an Intelligent, well thought out reply. Questions that can be answered with a google search or by searching at an obvious website (like this one), deserve very little time.

If he'd asked "Do people use Cocoa a lot for Mac applications" or "Is there a better framework then Cocoa for Mac applications" or "How can I use Cocoa from Python", I'd have more respect for the question.

In addition, this forum hasn't proven to be an utter wealth of information about programming the Macintosh. Yes, I'm sure some people here are knowledgeable - but this forum isn't an obvious place to look for Mac programming information (Windows - yes, *nix - maybe).

Monday, November 24, 2003

"What is the big deal about asking a simple question on this board?"

I agree with RocketJeff.  Bob is either lazy or he needs to work on his writing skills -- take your pick.  Imo, this wasn't a newbie question (i.e. World Class Programmer in 5 Years?).

While not on this forum, I sometimes reply to simple questions.  However, I have only do so when the poster has mentioned somewhere in their post that they were either too lazy to research the topic in question or they are a complete newbie.

One Programmer's Opinion
Monday, November 24, 2003

I disagree with RocketJeff. I have three Cocoa books on the bookshelf which I have read and am fully aware of all the links on google, even could spout off a few from memory, and yet I enjoyed hearing people's perspectives on this question. I would have called it an API. Finding out its definition encompassed the IDE as well was of interest to me.

Dennis Atkins
Monday, November 24, 2003

But are any of the answers useful to the original questioner. _Is_ Cocoa like COM?

Most of the people posting answers have answered *other* questions (and provided some interesting information), but I doubt if most of the answers are that useful to someone who has to ask 'What is Cocoa?'.

Monday, November 24, 2003

OK, well then let's decide what is COM? It is "Component Object Model" and sort of a way of writing DLL-like frameworks or libraries for objects like say a calender object or a clock or a text editor that can be inserted into your program. I  don't know, MS sent me the free CD with the COM devtools years ago but I never had occasion to mess with it -- to me apps is apps and drivers is drivers.

Would COM then be, much like frameworks can be inserted into your package in OS X?

Dennis Atkins
Monday, November 24, 2003

Cocoa is NextStep.

NextStep was an object-oriented Objective C application development framework originally designed for the NeXT computer. After NeXT failed it became OpenStep, then Apple bought them, repurposed it for OS X, and renamed it Cocoa.

"NS" is still the prefix used for the Cocoa API.

There is plenty of documentation on NextStep and OpenStep. Most of it still applies to Cocoa.

Dan Maas
Monday, November 24, 2003

To address COM more specifically... No, I wouldn't say Cocoa is similar to COM. Apple does have some cross-language interoperability stuff, and some RPC stuff, but that's not the focus of Cocoa. Cocoa is most like MFC or OLE (if you remember that :), with a little Visual Basic thrown in. (forms, etc)

Dan Maas
Monday, November 24, 2003

Cocoa isn't quite NEXTSTEP.

The original NEXTSTEP frameworks were actually quite a bit less object-oriented than Cocoa is.  The NEXTSTEP classes, which were all prefixed with "NX," relied on a lot of lower-level C APIs and data structures (like C strings etc.) to get things done.  If you use Google to search around for NEXTSTEP 3.3 developer documentation, you should run across some.

In the early 1990s, NeXT and Sun developed the OpenStep specification.  This was a much more object-oriented overhaul of the NEXTSTEP frameworks.  It was intended to be cross-platform, to have a version running on NeXT Mach (aka OPENSTEP), to have a version running on Solaris (Sun's OpenStep Solaris), to have a version running on Windows NT (NeXT's OpenStep Enterprise), and this open specification is also what GNUstep is based on.

Apple started enhancing OpenStep significantly with the release of Mac OS X Server 1.0 in early 1999.  Then it was called Yellow Box, and the major addition was the new document architecture.  (Previously you had to implement "documents" yourself.  Not hard, but tedious and easy to get wrong.  Sort of like developers using Windows Forms.NET have it today.)

With the release of Mac OS X Public Beta in mid-late 2000, Yellow Box was rebranded Cocoa and started gaining progressively more functionality.  The most recent version of Cocoa, in Mac OS X 10.3 (Panther) has a lot of features that weren't in the version released with 10.0 in 2001, much less the version in the 1993 OpenStep specification.

Even the 1993 OpenStep is an amazingly good framework.

Chris Hanson
Monday, November 24, 2003

*  Recent Topics

*  Fog Creek Home