Feeds

Making the move to the Mac

Mac development for Windows programmers

The Power of One Brief: Top reasons to choose HP BladeSystem

AppKit and Foundation Kit Frameworks

Hand in hand with Obj-C go the classes that are available to an Obj-C programmer. There are two main class libraries, Foundation Kit and AppKit. In general, the Foundation Kit (usually just Foundation) implements relatively low level objects such as arrays, strings, keyed dictionaries – a very "key" (sorry) part of Cocoa programming – and the like while the higher level AppKit brings GUI-related classes such as windows and panels, buttons, and scrollbars to the party.

Both these class libraries are implemented as frameworks. In Windows-land, examples of application frameworks include the Delphi VCL, MFC, .NET WinForms, and more. In Cocoa programming, framework has a more precise technical meaning. A framework is, basically, a directory which contains a shared library (like a DLL under Windows) as well as any resources (images, strings, sound files, etc) needed by the class library.

Importantly, the framework also contains any header files corresponding to the class libraries contained therein. This makes a framework pretty much self-contained apart from the obvious comment that it might itself depend on other frameworks. The upshot is that, when working with XCode (which we'll be looking at in Part 2) you can just drag an existing framework onto your project and XCode will immediately have access to all needed info.

Incidentally, while talking about frameworks, this would be a good point to mention "bundles". A framework is a specific type of bundle, but not all bundles are frameworks. A bundle is essentially a directory with a special suffix which causes the Finder to support the illusion that it's a single, indivisible file.

The most common type of bundle is an application bundle with a suffix of .app (Hint: try creating a new folder on your desktop, rename it to fred.app and you'll see the default application icon appear). An application bundle might contain numerous resources, support for multiple languages, and even one or more private frameworks. But the end-user sees only a single file which can be installed by simply dragging to the Applications folder or de-installed by dragging to the trash. Ah, if only Windows worked like that.

What Is Cocoa?

I've referred to Cocoa a few times in this introductory piece. What exactly is Cocoa? Well, opinions differ. If you check out the Wikipedia article on Cocoa (API) you'll be told that a Cocoa application is one written using the Cocoa programming environment.

Unfortunately, the article earlier contradicts itself by saying you can also use command-line tools and the gcc compiler to create a Cocoa app. The same article also suggests that Cocoa applications have a distinctive feel. I'd also disagree with this because you can get much the same distinctive feel using Carbon (the distinctive look and feel of OS X comes from the Aqua GUI which is available to Carbon and Cocoa). So what's my take?

Basically, a Cocoa application is one that makes use of the AppKit and Foundation frameworks. It's typically written in Objective-C, but could be written using any language which has bindings capable of accessing these Objective-C frameworks. It's typically created using the XCode development system but – again – you can use command-line tools if you wish.

The Carbon API, on the other hand, has been around for longer than Cocoa. Arguably, it's a lineal descendant of the original Mac toolbox APIs. Carbon is procedural, so it can be called more easily from C, Pascal, and so on. There is some debate at the moment regarding how much of Carbon is going to be ported to the 64-bit programming environment under Leopard. In this mini-series, I'm going to concentrate exclusively on Cocoa.

Next time round we'll look at XCode and Interface Builder, the primary Mac development tools. Again, I'll try to do it from the perspective of a Win32 RAD programmer. ®

Seven Steps to Software Security

More from The Register

next story
Secure microkernel that uses maths to be 'bug free' goes open source
Hacker-repelling, drone-protecting code will soon be yours to tweak as you see fit
NO MORE ALL CAPS and other pleasures of Visual Studio 14
Unpicking a packed preview that breaks down ASP.NET
KDE releases ice-cream coloured Plasma 5 just in time for summer
Melty but refreshing - popular rival to Mint's Cinnamon's still a work in progress
Leaked Windows Phone 8.1 Update specs tease details of Nokia's next mobes
New screen sizes, dual SIMs, voice over LTE, and more
Put down that Oracle database patch: It could cost $23,000 per CPU
On-by-default INMEMORY tech a boon for developers ... as long as they can afford it
Another day, another Firefox: Version 31 is upon us ALREADY
Web devs, Mozilla really wants you to like this one
Google shows off new Chrome OS look
Athena springs full-grown from Chromium project's head
prev story

Whitepapers

Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
Application security programs and practises
Follow a few strategies and your organization can gain the full benefits of open source and the cloud without compromising the security of your applications.
How modern custom applications can spur business growth
Learn how to create, deploy and manage custom applications without consuming or expanding the need for scarce, expensive IT resources.
Securing Web Applications Made Simple and Scalable
Learn how automated security testing can provide a simple and scalable way to protect your web applications.