Epic PyObjC, Part 5: Resources and Farewell
This is the final section of the Epic PyObjC tutorial. Hopefully you've gotten a better grip on both PyObjC and Cocoa.
First, here are a few statistics from the series:
Segment | Words | Characters | Chars/Word |
Part 1 | 3593 | 25005 | 6.96 |
Part 2 | 3313 | 22698 | 6.85 |
Part 3 | 2717 | 19160 | 7.05 |
Part 4 | 3768 | 25685 | 6.82 |
Total | 13391 | 92548 | 6.91 |
I guess the most striking thing to me was that the average word length didn't vary much between articles. Anyway, you didn't come to see statistics, you came because I promised resources.
Well... I'll try to deliver.
PyObjC Examples
One of the best way to figure out a specific concept in PyObjC is to look at the excellent example projects, which are already installed locally on your machine at /Developer/Examples/Python/PyObjC/
. The one caveat is that some PyObjC examples can be a bit outdated. Specifically, they occasionally use NibClassBuiler.AutoBaseClass
as the base class instead of explicitly subclassing a real class (NSObject
, etc), which is deprecated. If you ignore that, though, the remaining implementation details should be of great help.
Objective-C
I first started developing Cocoa applications using PyObjC, and it wasn't until later that I learned Objective-C. After developing a few applications in pure Objective-C, I decided that PyObjC really was the better way, but a Cocoa developer will never regret the decision to become comfortable with Objective-C.
The most obvious reason is that by limiting yourself to PyObjC documentation you'll be living in a very small and unhappy box. Beyond that, you can use Objective-C to optimize parts of your code that require a compiled language's performance, and will also get to know the multifacted and resourceful Cocoa libraries better once you no longer have Python's included batteries to rely on.
- Apple's The Objective-C 2.0 Programming Language is an indepth introduction to ObjC 2.0.
Core Data
I briefly mentioned Core Data during part two of this tutorial, and its a really brilliant tool to work with. Although it isn't applicable to all your projects, for those it meshes with it can--combined with Cocoa bindings and various controllers (of the NSObjectController
and NSArrayController
varieties)--handle creating schema for data types, connecting data, creating data, deleting data, displaying data... you can essentially create your entire application with them.
The Apple Documentation's high level overview of Core Data is good for getting your feet slightly damp.
CocoaDevCentral's excellent introduction to implementing a Core Data application will have you actually going through the motions (lots of InterfaceBuilder goodness) of using Core Data. Its in Objective-C, but you won't find a better introduction.
The Apple Documentation's thorough introduction and discussion of the many minutiae of Core Data. The writing style is less accessible than a security vault, but when you need to know the details this is the best place to look.
Cocoa Bindings
We spent a considerable amount of time in the tutorial working with Cocoa bindings, but there is almost always something more to learn to further reduce the amount of code you need to write for your applications.
CocoaDevCentral's Intro to Bindings. It might seem like I'm recommending everything on CocoaDevCentral indiscriminately, but I worked through all the material there when I learning Objective C, and its uniformly excellent stuff.
Apple Documentation's Introduction to Cocoa Bindings is the gateway to Apple's myriad resources on Cocoa Bindings.
Start a Project; Jump Off a Cliff
In the end, the way to become more proficient using PyObjC is the same as anything else: start an ambitious project, and make it work. When you run into challenging spots, don't redesign your application to avoid difficulties. Hit 'em straight on and figure out the details as you go.
I greatly appreciate the manifold corrections and comments I have received so far, and please let me know if I've made errors or have any ideas how I can continue improve this tutorial.
Thank you for reading - Will