The Cheapest Generation

Link: The Cheapest Generation

Article in The Atlantic about how millennials just aren’t as interested in buying houses and cars as our parents:

The largest generation in American history might never spend as lavishly as its parents did—nor on the same things. Since the end of World War II, new cars and suburban houses have powered the world’s largest economy and propelled our most impressive recoveries. Millennials may have lost interest in both.

I don’t know if I’m different than other people my age — this article says I’m not — but debt of any kind has always scared the crap out of me. It’s difficult for me to paint buying a new car or a house in any other terms than a lot of money I’m going to owe someone else. I just can’t get more excited about either of those things than I am scared of the debt they represent.

Pinbook Support in Sunstroke Fever Reader

If you use Shaun Inman’s Fever for RSS, the app Sunstroke just got a big update which, among other things, adds iPad support. One of the other features I’m a pretty big fan of is support for using Pinbook to send links to Pinboard. To enable it, go to Settings, find Sunstroke, and switch it on. Because the app takes advantage of Pinbook’s x-callback support, it’s really seamless and you’re sent right back to Sunstroke after you finish.

Azure Mobile Services and Core Data May 1st in Portland

On May 1st, I’ll be giving a presentation on Core Data at Microsoft’s Portland offices, and Josh Twist (of the Windows Azure team at Microsoft) will be giving a presentation on Windows Azure Mobile Services.

I saw Josh give this presentation in Seattle a few weeks back, and it’s great. They’ve really made something that can make a lot of developers lives easier without needing to be an expert on writing server software.

Also, there’s going to be free pizza.

It’s right downtown, so I’m sure some of us will go out for drinks after. It’s free — but space is limited — so register on EventBrite if you’d like to come.

Stop Using Success/Failure Blocks

I‘m not entirely sure where this first started, but a pattern that you seen a lot in third party Objective-C libraries is using separate success/failure blocks for callback on asynchronous API. It’s surprising that is has caught on for a couple of reasons. The first is that most good Objective-C developers seem to want to do things the “the Apple way,” and Apple doesn’t use this pattern anywhere. The other reason is that the problem with it isn’t an edge case, but something you’ll come up against whenever you use the pattern.

As an example, here‘s a piece of code that uses separate success/failure blocks:

[object doSomethingWithSuccess:^(NSData *data) {
    [self.activityIndicator stopAnimating];
    // Do something with the data
} failure:^(NSError *error) {
    [self.activityIndicator stopAnimating];
    // Do something with the error
}];

And here’s how I’d write it:

[object doSomethingWithCompletion:^(NSData *data, NSError *error) {
    [self.activityIndicator stopAnimating];
    if (data != nil) {
        // Do something with the data
    } else {
        // Do something with the error
    }
}];

If you go and look at any Apple API that uses a completion handler, you’ll see they follow the second pattern. Using separate success/failure blocks forces you to repeat code, because cleanup code is usually independent of success or failure. Don’t do that.

[Update 4:28 PM: As Tim pointed out in the comments, the success flag I had on my callback block was superfluous, so I removed it from the example.]

NSHipster Discusses iCloud

NSHipster talking about iCloud:
> The Lisa. The Twentieth Anniversary Macintosh. The iPod Hi-Fi. The MacBook Wheel.
>
> Each of these products exemplifies Apple’s obsessive pursuit of quality as much as its unrivaled ability to anticipate the direction of things to come and execute flawlessly.

It only keeps getting better from this point on.