Dan Wood: The Eponymous Weblog (Archives)

Dan Wood Dan Wood is co-owner of Karelia Software, creating programs for the Macintosh computer. He is the father of two kids, lives in the Bay Area of California USA, and prefers bicycles to cars. This site is his older weblog, which mostly covers geeky topics like Macs and Mac Programming. Go visit the current blog here.

Useful Tidbits and Egotistical Musings from Dan Wood

Categories: Business · Mac OS X · Cocoa Programming · General · All Categories

Wed, 17 Jan 2007

Person Merging

I like to work down at a nearby café one day a week or so, just for a change of pace, and to try to emulate the behavior of famous software companies. :-) Recently I started chatting with another patron there when I noticed that he stopped bringing in a Windows laptop and was now using a Mac. I learned his first name, and over the last couple of months, we've chatted at bit when we run into each other there.

Meanwhile, I've been corresponding with a fellow Alameda resident over the last couple of months; he has started up a local political group that I've been hoping to get involved with — but haven't yet.

Yesterday I discovered that those two people — the guy at the café and the guy I've been exchanging emails with — are the same person!

What a strange thing to happen, to have to now merge two "people" (in my mental model of the world) into one!

Generating Standard Objects from Core Data Models

I recently had the occasion to create a number of cocoa classes. These ones were not using Core Data, but I thought it would be cool to make use of XCode's modeling tools and build up my objects as a Core Data model.

To accomplish this, I first ran across Jonathan 'Wolf' Rentzsch's mogenerator (installing by following this excellent tutorial).

mogenerator is little program that analyzes your data model and spits out classes (in two halves, a machine-generated part and a developer-modifiable part). But the classes that are generated are intended to be NSManagedObject subclasses, which I didn't want.

So I rebuilt the template files (which you install into ~/Library/Application Support/mogenerator/) to build instance variables, more standard accessors, an init and dealloc method, and so forth.

These files are available for download here. If you use it, you might want to modify these further, to change the accessor styles, replace NSMutableSet with NSMutableArray, and so forth. But it might be a useful start for your project.