Blended Cocoa

Adventures in Objective-C, Swift and Cocoa

/dev/world 2012 Presentation

I recently gave a presentation at the AUC’s /dev/world conference. The video recording of my presentation, Adventures in the Objective-C Runtime, is now available on the AUC website at http://auc.edu.au/2012/08/objective-c-runtime/.

I have included the presentation abstract below:

Adventures in the Objective-C Runtime

The Objective-C language is dynamic, many decisions are deferred from compile and link time to runtime. The dynamic nature of the language is implemented by the Objective-C runtime, which acts as a kind of operating system. Typically, you don’t need to interact with the runtime directly…

…but what can the runtime do for us if we choose to be atypical.

Categories are generally the first dynamic feature of the language that programmers new to Objective-C discover and this is where we will start. To understand how categories work we will look at message sending and method swizzling. From here we’ll be able to look at other features of the runtime.

In order to understand what the runtime is doing we will need the ability to inspect what it is doing internally, for this we will take a quick detour into DTrace profiling. We will also take a quick look at benchmarking to see if (and by how much) the dynamic nature of the language slows it down.

Messing around in the runtime has the potential to cause havoc, however, the runtime can be used to solve problems in novel and powerful ways. We will close by looking at some examples of using the runtime. Key Value Observing and Core Data are obvious examples from the Cocoa frameworks.

Comments