Cocoa Framework

Apple's present-day name for the NextStep / OpenStep / GnuStep / YellowBox? class frameworks. An advanced ObjectOriented framework for rapid application development. One of three major APIs (Cocoa, Carbon, Java) for programming on MacOsx.

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

Uses the DelegatePattern? and ModelDelegate pattern pervasively, as supported by ObjectiveCee and Java. ObjectiveCee 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 CoreData, to ship with the next release of MacOsx ("Tiger") in early 2005.

http://developer.apple.com/cocoa/index.html

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

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

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

Language bindings

The framework is designed to be programmed using ObjectiveCee, but Apple provides a bridge to Java (not used by many programmers) and AppleScript (through AppleScriptStudio?).

NuLanguage 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:

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 AppleScript.

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 EnterpriseObjectsFramework (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 AppleScript 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 OpenStep 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 (CoreData, 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: AddressBook?, iCal, ExCode, InterfaceBuilder, and there are many more), and InterfaceBuilder which not only lets you build interfaces graphically but has guides that help you to conform to the HumanInterfaceGuidlines? 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 WebObjects and YellowBox? for windows lisences can still be purchased at the Apple website). They have recently added WebKit?, which allows for html rendering (check out DashBoard? on the apple site for some of what they use it for), as well as a DOM model for XML, and JavaScript 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, WebKit?, SpotLight?), is easy to develop in, runs in many places, from many programming languages, has multiple implementations (GnuStep, OpenStep 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 NextStep 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 - InterfaceBuilder 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 WebObjects and the old GUI layers of EOF).

Old is a relative term. In any case, EnterpriseObjectsFramework is making a comeback in CoreData.


CategoryFramework


EditText of this page (last edited December 30, 2010) or FindPage with title or text search