Brag of the Day: Brent Simmons Favorite Tweets
This is probably super-unseemly, but why should that stop me?
Brent Simmons posted this
Here’s a line of code that just made the in-development app throw an exception:
NSArray *uniqueIDs = [syncNotes valueForKeyPath:VSSyncNoteIDKey];
Looks good, right? But it’s wrong. I replaced it with this — and the bug was fixed: NSArray *uniqueIDs = [syncNotes valueForKeyPath:@"uniqueID"]; I know the three knocks against using string literals:
It’s hard to spot typos by eye.
The compiler won’t catch errors.
If you make a change, you have to change it in multiple places.
But I’m exceptional at spotting typos. And I almost never have cause to change the value of a key. (And if I did, it’s not like it’s difficult. Project search works.)
This guy posted this
I’m not going to judge Brent here on his solution, but it seems to me like this problem would be much better solved by using string constants provided Xcode actually showed you the damn values of those constants in auto-complete.1
I responded with this in a tweet:
and Brent Simmons did this
my day is made...
I basically agree with him. That is why I did what I did. ↩︎













