Cocoa Framework

Apple's present-day name for the Next Step / Open Step / Gnu Step / Yellow Box class frameworks. An advanced Object Oriented framework for rapid application development. One of three major APIs (Cocoa, Carbon, Java) for programming on Mac Osx.

The class framework is supported by Interface Builder, a graphical user interface design program, which supports archiving serialized objects inside the interface description files.

Uses the Delegate Pattern and Model Delegate pattern pervasively, as supported by Objective Cee and Java. Objective Cee has builtin message passing and messages are real data types, making this style of programming particularly easy.

Smalltalk programmers sometimes complain that it lacks a rich collection hierarchy. It has bags, sets, arrays, and dictionaries but they don't inherit from any common ancestors. Strings are not arrays and it uses C numbers and characters for the most part.

The framework is usually considered weak on XML support and networking, but open source libraries are available in those areas.

Is the XML support still considered weak? Apple added a bunch of NSXML* classes recently, so perhaps this is no longer true

A new database access framework is expected in the form of Core Data, to ship with the next release of Mac Osx ("Tiger") in early 2005.

O'Reilly book: Learning Cocoa, www.oreilly.com , ISBN 0-596-00160-6

Aaron Hillegass wrote a better book called Cocoa Programming for Mac OS X ISBN 0201726831 www.bignerdranch.com

Unrelated to Cocoa World, the graphical programming-by-example environment aimed at children developed by Apple R&D in the 90s (which was itself formerly known as Kid Sim).

Language bindings

The framework is designed to be programmed using Objective Cee, but Apple provides a bridge to Java (not used by many programmers) and Apple Script (through Apple Script Studio).

Nu Language handles native Cocoa objects without needing a binding (or, if you prefer, the binding is trivial).

Third-party bindings are available for the following languages:

OpenMCL (openmcl.clozure.com ) is a ANSI Common Lisp implementation with an experimental Cocoa interface.

Fscript Language is a Smalltalk implementation that uses Cocoa classes.

Discussion

It discourages users from inheriting from Cocoa classes except for NSObject and NSView. Recently they added NSWindowController and NSDocument and designed them to be inherited. The earlier scheme used delegation everywhere a programmer would want to use inheritance, which many people considered a good thing.

I would consider it a few years old compared to other frameworks. It has no support for Corba or OLE. It's distributed objects implementation has been ignored in favor of using Apple Script.

The Cocoa distributed objects system would have never worked with the existing non-Cocoa applications (like Photoshop or Word). And why does lack of support for Corba/OLE make Cocoa "a few years old"? How can you measure the age of a library, except by stating the time that it was initially written or last updated?

It has a really good object archiving scheme that it uses when designing the UI in Interface Builder. This is one of its strong points. It also has a nice plugin system that I really have not seen used very much except for OS X's System Preferences where you can add your own preference panel if you have an app that runs with no UI. Sadly the Finder (Desktop) is not yet written in Cocoa. Hopefully they will rewrite it and add some plugins so people can customize it a little.

It used to have a related framework called Enterprise Objects Framework (EOF) that handled database access. They have since killed the Objective C version and moved to Java. Cocoa is also available for Java by the way. I don't know anyone using it since Cocoa for Java is only on Mac OS X and Obj C is way better. Next (creators of Cocoa) at one time was going to ditch Obj C in favor of Java. This idea got dumped and they now recommend using Obj C.

In summary, at one time it had database access, distributed objects, good plugins, and a good UI creator. It also ran on Windows, Sun, and Next OS so you could actually write once and run on all those systems and it actually ran fast. They've since gotten rid of database access, distributed objects, and Windows and Sun compatibility. The only major thing they are adding is Apple Script support, which hasn't reached its full potential yet (recordability and easy interapplication communications). At this point I think Cocoa used to be a lot cooler, and now has a lot of kludge. Can any old Open Step programmers comment on this. These are the opinions of a Mac OS and Smalltalk programmer, not an old Next programmer.

In Summary (a contrasting view) it has database libraries (Core Data, NSUserDefaults, NSPropertyList, third party SQL libraries, and others), the best distributed objects system I have ever used (2 lines of code to make a named object accessable system wide, 1 line to access it from a remote piece of code be that in another thread, process, or across a network), great plugin support (for those who want a plugin-based application, some apps that have it include: Address Book, iCal, Ex Code, Interface Builder, and there are many more), and Interface Builder which not only lets you build interfaces graphically but has guides that help you to conform to the Human Interface Guidlines and archives real objects, not xml which is parsed to create interfaces... It supports many languages including (but not limited to) ObjC, Java, perl, ruby, python, eiffel, FScript and more. The framework is usable on Macs, and Windows (yes Web Objects and Yellow Box for windows lisences can still be purchased at the Apple website). They have recently added Web Kit, which allows for html rendering (check out Dash Board on the apple site for some of what they use it for), as well as a DOM model for XML, and Java Script interpreter. In short, it used to be kind of an in the shadow thing that only really ran on NeXT machines, but now it has piles of new features (Bindings, Web Kit, Spot Light), is easy to develop in, runs in many places, from many programming languages, has multiple implementations (Gnu Step, Open Step etc.) and did I mention that it only looks to get better. These are the opinions of a Mac OS and ex-C++ programmer, not an old Next Step programmer.

Well, speaking as an old NeXT programmer, I'd still say I think Cocoa is absolutely fantastic. True, it is quite a shame that there is no modern-day EOF equivalent which is easily accessible (without messing with all the Java/ObjC bridge nastiness), but Apple has improved it (and the IDE - Interface Builder etc) in quite a few ways. It's still the nicest UI layer that I've come across. The newer bindings technology recently added is also interesting (it adopts ideas previously used in Web Objects and the old GUI layers of EOF).

Old is a relative term. In any case, Enterprise Objects Framework is making a comeback in Core Data.


See original on c2.com