About Cocoa API-based applications
Cocoa applications make use of an object-oriented set of frameworks (libraries) which have been developed over the last couple of decades or so by NeXT/Apple. The Cocoa fameworks are written largely in Objective-C, making this an ideal language to program in Cocoa. However, there are many language bridges available to allow other languages to access Cocoa, giving the programmer a nice set of choices. More languages are being brought to Cocoa as I type.
Learning to program in Cocoa has three basic parts: picking a language and learning its syntax, learning to write object-oriented programs, and becoming familiar with the Cocoa libraries and appropriate design patterns.
Cocoa Languages:
- Objective-C, a superset of C, a thin layer adding objects to standard C, modeled on Smalltalk, is available on several platforms and compilers, though the dominant Objective-C platform is OS X. As of Mac OS X 10.5 (Leopard), the language is 64-bit clean, has automatic garbage collection, properties, synthesized methods, etc. With 10.6 (Snow Leopard), the language includes blocks and the Cocoa API has major improvements to help with multiprocessor programming.
- Many other languages below use a "bridge" to talk to Objective-C code, which in turn accesses the Cocoa libraries. This bridging is usually a minor issue, and often comes down to just knowing how to make use of Apple's Obj-C documentation alongside the language you're using.
- Apple is the official maintainer of the Objective-C compiler source code for the GCC compiler, used throughout OS X. One may also make use of the gigantic amounts of C++ libraries out there from within Objective-C (termed "Objective-C++"). (native)
- AppleScript is a system-wide, inter-application, object-oriented scripting language. Apple has created a Cocoa framework called AppleScript Studio which allows AppleScripts to be wrapped in Cocoa applications, to make Obj-C calls from AppleScript, and vice versa. (bridged) Since Snow Leopard, AppleScriptObjC is available as a native interface to Objective-C from AppleScript.
- An object-oriented BASIC can be used via Objective-Basic (native).
- C# can bridge to Objective-C inside the Mono framework via CocoaSharp, NObjective, Monobjc, and mobjc (bridged)
- D programmers can make use of the D/Objective-C Bridge. (bridged)
- Eiffel can compile using the Cocoa frameworks using the EiffelCocoa API. (bridged)
- F-Script is a strict superset of Objective-C that allows for a higher level of programming abstraction. It's an OO scripting language with a nice object browser based even more on Smalltalk than Objective-C itself is. Smalltalk and Ruby coders will quickly feel at home in this language. (native)
- Haskell has an objective-c binding called HOC which allows compiling of Cocoa apps. (bridged)
- Io has an Io/ObjcBridge. (bridged)
- Java support for Cocoa is built-in to OS X. Apple has frozen support for this bridge moving into the future, and is best used in accessing non-GUI Java code. (bridged)
- JavaScript has access to Cocoa via the WebKit framework, and there is also JSCocoa and JSTalk to use the Cocoa libraries from JavaScript. (bridged)
- Lua, a light-weight procedural language, has been given a taste for Cocoa through Lua Objective-C and LuaCocoa. (bridged)
- Marten is a graphical programming language that can be used to compile a Cocoa application.
- Modula-2 has a set of extensions for taking advantage of Cocoa via the Objective Modula-2 project. (native)
- Nu is a Lisp/Ruby-based language written on top of Objective-C, so that it has direct Cocoa goodness. (native)
- Both Clozure CL and LispWorks have a Cocoa interface. (bridged)
- A program called Pashua allows one to create double-clickable, GUI Cocoa apps using any of the following scripting languages: Perl, Python, Tcl, PHP, Tcsh, Rexx and AppleScript.
- Perl programmers can make use of the Cocoa frameworks for making native GUI applications thanks to the CamelBones project, as well as by using the PerlObjCBridge. (bridged)
- Prolog can be used with the Cocoa API by way of the XGP development environment.
- Python, an OO scripting language, can be used to message Objective-C calls via PyObjC (bridged) and one can also use Appscript (also bridged).
- Ruby is a dynamic OO scripting language which has been linked with Cocoa via RubyCocoa (bridged) and/or Appscript (bridged), and there's a newer implementation of Ruby written atop Objective-C called MacRuby (native).
- The Scheme-based music programming language called Impromptu has its own Obj-C bridge. (bridged)
- The Squeak implementation of Smalltalk can be used via CocoaSqueak, and Ambrai Smalltalk can talk to Cocoa via Objective-C. (bridged)