Monthly Archives: August 2008

Development on the Mac

Macs have long been popular with graphic designers and in the entertainment industry. Since the release of the original Mac OS X, and with every subsequent release, more and more developers are discovering that a Mac isn’t just something that sits in the corner and looks pretty. Let’s take a look at what Macs have to offer to the developer community.

Mac applications
If you want to develop applications for the Mac, needless to say, you’ve gotta do it on a Mac! The de-facto language of Mac developers is Objective C, an object oriented extension of C with Smalltalk like syntax. Objective C adds concepts like messaging and automatic memory management (with Objective C 2.0) to C. In other words, Objective C code is like pure C code with object oriented constructs. This makes the code readable for anyone with background in C.

If you are looking to write Mac applications, it’s looking increasingly like Cocoa is your only remaining friend – not that there’s anything wrong with it! For a long time Mac developers have had two options for developing native applications – Cocoa and Carbon. Carbon is the older options of the two, allowing users to write their applications in pure C/ C++. Many popular Mac applications like Microsoft Office and Adobe Photoshop are written in Carbon though with the release of Leopard Apple seems to be signaling that Carbon’s time is up (no 64 bit support for Carbon in Leopard). Thus, if you are starting off developing a Mac application in today’s world, you are well advised to stick to Cocoa. Cocoa is a collection of modern frameworks and APIs that allow you to build “Mac like” applications. As mentioned above, Objective C is the most popular (and Apple’s recommended) option for Cocoa developers, though one can also use languages like Python and Ruby (via bridges).

Apple complements these modern frameworks with ultra-modern developer tools. Xcode (the IDE) and Interface Builder are playgrounds that any developer would love to play in and are supplemented by nifty tools like Instruments that allow you to monitor your application performance in real time. All this, of course, comes with tons of documentation and sample code – think of it as MSDN without the pain!

Web Developers
Web developers have the advantage of developing in an environment that comes with a pre-installed industry standard web server (Apache) and a modern web browser (Safari). You can supplement your experience with popular cross platform tools like Dreamweaver or mac native stunners like Coda, that offer single-window web development experiences. You can test your web apps on a wide variety of browsers like Opera and Firefox (or it’s Mac only cousin Camino) that have their Mac native versions and even on Internet Explorer without going anywhere near a Windows machine via VMware Fusion/ Parallels or Boot Camp. Think small is beautiful? Take a look at Apple’s Dashcode, a tool dedicated for development of nifty web widgets.

The Ruby on Rails (RoR) community has taken to Macs in a big way – infact all “core” Rails team members use Macs! This is down to the relative ease of installing (and running) a wide variety of databases (MySQL, PostgreSQL, SQLite etc) and web servers (e.g. LightTPD) on a Mac as well as the emergence of a text editor called TextMate that has RoR specific “bundles” which make development a breeze. Ruby on Rails comes pre-installed on all Macs.

Java
Java is both a strong development environment for the Mac in terms of the tools available and also a way for developers to bring their applications to the Mac platform. In terms of IDEs you are spoiled for choice with popular tools like NetBeans and Eclipse vying for place on your Desktop. Many popular cross-platform applications like Azureus and Oracle SQL Developer found their way to the Mac thanks to it’s strong Java support, which makes it easier for developers to port their Java applications to the Mac.

One thing to note for Java Developers is that all Java updates for the Mac are published by Apple and not Sun, as it does for other platforms. This means that often there is a slight lag between the time a major Java version is available for, say, Windows and Mac.

Unix
Mac OS X is a full POSIX complaint system, meaning you can do on on the Mac pretty much whatever it is that you can do on your favourite Unix/ Linux flavour. So go on use your favourite *nix tools (awk, sed etc.) and write shell scripts for your favourite shell – Korn (ksh), Bourne (bash) etc. You have the advantage of using powerful graphical text editors like TextMate, BBEdit, TextWrangler and others for writing/ editing your scripts if vi and emacs give you the creeps!

While not restricted to the *nix platform, both Perl and Python have strong *nix underlying philosophies. Mac OS X comes pre-installed with both Python and Perl. Affrus is a popular Perl IDE offering integrated and debugging support.

Oracle
Oracle developers can get the Oracle client that allows them to connect to Oracle databases from their Mac. Or you can make your Mac into a database server by installing the Oracle server for Mac. Though there isn’t quite a TOAD (a popular tool on the Windows platform) equivalent for Mac in terms of the sheer volume of features that TOAD provides, Oracle’s very own SQL Developer and a third-party Mac native application called SQLGrinder are more than able deputies.

C/ C++
Mac OS X developer tools include gcc which you can club with your favourite IDE/ text editor to get a first class C/ C++ development experience. As far as libraries and code portability are concerned, your development experience would be comparable to that of developing on any other *nix flavour.

Windows
I am sure this is one sub-category that you never expected to see here. Truth is, however, you can use .NET Studio and whatever else it is that you use on your Windows machine, exactly the same way on your Mac to develop native Windows apps! This thanks to VMware Fusion/ Parallels that allow you to work seamlessly with Windows apps within Mac OS X, or Apple’s Boot Camp that allows you to dual-boot between Windows and Mac OS X.

iPhone
Though you can develop web applications or widgets for the iPhone on any platform, if you are planning to build “real” applications that use the underlying OS technologies, you’ll need to develop via the iPhone SDK. The iPhone SDK, as of writing of this article, requires Mac OS X Leopard and does not run on Windows or any other platform. As part of the SDK iPhone developers gets the same set of tools as their Cocoa counterparts – Xcode, Interface Builder and Instruments – as well as an iPhone Simulator, to see how your application would actually behave on the iPhone.

Originally published at the CIOL developer network.