Cocoa, CoreData, and XCode are sucking my will to live
Recently I tweeted this and got a reply from @pilky asking what in particular was bothering me. Since I had more than 140 characters of gripes, here we go.
Before I get into full rant-mode:
- I’ve liked my iPhone development experience and Cocoa is a compelling platform.
- I’m willing to admit that I might be spoiled. And before you jump to conclusions, yes I am a Ruby developer and most of my experience is in web apps. It’s true, I’m one of them.
- I know things aren’t this way just because people at Apple want me to suffer. They’ve done some impressive things and on the whole, I have a positive opinion of the development environment.
- More than likely, there are perfectly acceptable solutions to some if not most of these. However, I have been following the demo applications fairly closely, so if there’s something better, it’s not exactly obvious.
But, I do have to vent:
Cocoa (Objective-C too, I guess):
- If I want to add a simple accessor, I have to make changes in at least four places! Twice in the header: the instance variable and the
@propertydeclaration. Then twice in the implementation file: once for the@synthesizedeclaration and then release it in thedeallocmethod (granted garbage collection would help, but this is the iPhone). There’s no way to be DRY when the language makes you repeat yourself. When are these lines going to be different? Why can’t there be a terse standard behavior and an expanded 4+ line version for when efficiency or special use cases demand it? - Ridiculously long method names. Sure code completion helps writing them, but what about reading them? How many times do I have to read
tableView:(UITableView *)someTableView cell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath canHasCheeseburger:(Cheeseburger *)cheeseburger? - Namespacing. Ain’t got it. UI, NS, CL, CF, etc. Just don’t like it.
- Numeric constants with tremendously long names. Same complaints as the last two, however given numbers it’s even harder to debug, especially in callback functions when you’re not sure what the API is actually doing.
CoreData:
-
[NSEntityDescription insertNewObjectForEntityForName:(NSString *)entityName inManagedObjectContext:(NSManagedObjectContext *)context]is a convenience method for creating a new NSManagedObject. That’s convenient?! It’s even less convenient when it silently produces a nil instead of an object because something is wrong with the NSEntityDescription. - No general purpose data viewer. For all of the really excellent development tools, why can’t I specify an xcdatamodel file and a data file and be able to browse it? Best I could get was cd to ~/Library/Application Support/iPhone Simulator/User/Applications/{long application id}/Documents/ and open the sqlite3 command to open it. Given that CoreData does some funky things with it’s DB schema, I’d rather not resort to this. And god help me I were using more of CoreData’s immense and impressive capabilities.
- How many lines does it take to do the equivalent of
SELECT * FROM my_table ORDER BY created_at DESC? I’m counting 12 not including whitespace. And that’s without a predicate. Now, this isn’t just annoying. And before someone says, “Oh look at this guy he doesn’t like typing stuff—what a dumbass” realize how hard this is to query your datastore from a debugger. Wouldn’t it be nice if there was some kind of general purpose data viewer?
Xcode
- Lack of language specific indentation rules. Objective-C uses hard tabs/4. Ruby uses soft tabs/2. And now I have an iPhone app that is soft/2 because I forgot to switch after playing around with MacRuby. :-(
- Autocomplete is sketchy sometimes. The normal argument for why wordy APIs are fine is that “good” IDEs will make it all better. But when I have an instance variable with the same name as a class, autosuggest gives me the class name.
Well, that felt good. Did anyone actually read all of this?

