As You Were

Devin Coughlin's blog.
Styles: Serious Spare

October 31, 2006

Falling Back

I started in on some code today that I hadn't touched since last week, only to have a bunch of previously passing unit tests fail. Yeah, it was a daylight saving bug. Not in the code itself, which was designed to work with such things, but in the tests. I was, for no good reason, converting dates to strings and then comparing those with expected strings. But the string conversion depends on the number of seconds from the meridien, which changed (at least for me) this weekend. Doh. Much better to compare dates explicitly.

There's a lesson in there, somewhere. (Maybe it's to avoid date and calendar programming).

Posted by coughlin at 5:17 PM

October 29, 2006

Oh, This Modern World ...

... In which Ian McDonald has a blog.
Posted by coughlin at 8:18 PM

October 23, 2006

WWDC Sessions on iTunes

Huh. This never ocurred to me, but in hindsight it is obvious.

They are putting the WWDC sessions up on iTunes. All WWDC attendees can access them.

Posted by coughlin at 4:58 PM

October 20, 2006

[hello world]

I'm in Chicago for C4.

Posted by coughlin at 7:41 PM

October 19, 2006

Somewhat Late WWDC 2006 Wrap Up

So WWDC ended two months ago and it is a little ridiculous to write a wrap-up this late in the game. Nonetheless, I've been listening to MacBreak Weekly (as recommended by Daniel Jalkut) in reverse chronological order and finally got to their inaugural coverage of WWDC, which made me think about my expectations for the conference and the direction of MacOS X. It's a bit tardy . . . I've been occupied by other things as of late . . . but here follows my obligatory WWDC 2006 Wrap Up.

Predictions, in Retrospect

In early August I made a series of predictions about what was in store. Not all of them turned out to be accurate.

  • Resolution Independence

    Prediction: I think this is pretty much a given.

    Verdict: Not really.

    Everyone expected Resolution Independent Displays (boy, does that need a good marketing name) to be a big deal for Leopard, but Apple doesn't seem to think it is. It's going to take longer than you might expect for this to happen. I imagine this is because high dpi displays are still too expensive.

  • New View Technologies

    Prediction: The view would be written in something like quartz composer and would be parameterized by thing like a bounds rect, content value, elapsed time parameter, etc. Then in your drawing code, rather than actually drawing the gradients and images you need, you would send the appropriate parameter values to the shading language program on the graphics card

    Verdict: Ummm... No.

    While we did get a new view technology (Core Animation nee LayerKit), it is definitely in the same vein as the current imaging model. The basic drawing MO is still imperative: a program runs a series of commands that draw into a bitmap, then the GPU treats the bitmap like a texture: the graphics card will map it to a surface, distort the surface, rasterize it, apply filters to it, and finally composite it on the screen. The goal is to run the drawing code as little possible and let the GPU do the heavy lifting. The as yet unanswered question in all of this is where does the drawing take place — you'd really like to transmit the drawing commands to the GPU and have it draw into a texture on GPU, but as of yet this is an unknown implementation detail.

    Core Animation is actually a big deal — but its implementation is of much less importance than what people will do with it.

  • 64-bit UI

    Prediction: I expect Leopard to support 64-bit UI apps. . . . Unfortunately, I think were looking at multi-disc installs again.

    Verdict: Yes. And No.

    Just about everything is going 64-bits, which is an opportunity for Apple to escape from the tyranny of backwards compatibility and jettison some APIs that should have been put to sleep years ago. (I had assumed that they would use the switch to Intel to do this, but I guess the x86 death march was too swift to do much more than a cursory port.) While some of the deprecated APIs are for frameworks that don't really make sense any more (QuickDraw, the Code Fragment Manager) others, like the Obj-C runtime, were replaced with more abstracted APIs that offer similar functionality but expose less of the internals. And, apparently, there is no need for multi-disc installs.

  • Hypervisor

    Prediction: I think, unfortunately, we are entering the era where commercial OS developers will use hypervisors to support their DRM schemes.

    Verdict: No. Not yet.

    I tend get exited about hypervisors because their implementation is such an interesting topic, but for any use but virtualization they are bad, bad, bad for users.

  • Wither Open Source Darwin?

    Prediction: Call me an optimist, but I think Leopard's version of xnu will be open source.

    Verdict: Yes.

    This is a very good thing. I'd love to know why they withheld the Tiger Intel sources.

  • An End to SIMBLs, haxies, mach_inject, etc.

    Prediction: At the very least, I expect application developers (with possible user override) to [be able to] designate their apps protected from injection. Of course apps that allow plugins would have to implemenent some kind of code signing so they would know what plugins to trust — that's what the Trusted Platform Module is for, right?

    Verdict: No.

    We're still waiting for the other shoe to drop. Access protection between users is not good enough, as anyone who has ever gotten an e-mail virus can attest to. These kinds of automated user-attacking-herself attacks are the problem in desktop security. I don't think anyone has a good handle on how to deal with this issue yet.

  • Better integration between Xcode and Interface Builder

    Prediction: There are good reasons to keep IB and Xcode decoupled, but for small developers, at least, increased integration would be a major timesaver. Hopefully they'll also make it easier to use my custom views and cells in IB.

    Verdict: More or less.

    Xcode is slowly adding features and I look forward to IB in Leopard.

Surprise: Objective-C 2.0

Even though the changes in Objective-C are more evolutionary than revolutionary, this is a really big deal. I was expecting garbage collection, if anything, and not a lot else, so this was a pleasant surprise. More than anything, this signals to me that Objective-C is going to stick around for the long haul.

  • Properties

    Objective-C's bizarre infix-style method calling syntax is one of its greatest features, but its verboseness is a big turnoff to those learning the language. Properties, a feature common in many other languages, provide an instance variable-like interface while allowing the encapsulation provided by getters and setters in the implementation.

    So, in Objective-C 2.0 the following turd of actual code

    newItem = [[[self rootToDoItem] valueForKey:@"model"] insertedToDoItemWithDescription:@"Buy eggs"];

    could be rewritten as

    newItem = [rootToDoItem.model insertedToDoItemWithDescription:@"Buy eggs"];

    which is still a disaster, but at least it's a more legible disaster. Objective-C 2.0 is much less write-only than its predecessor.

  • Enumeration

    We get a fast @foreach(Foo *foo in bar) like other languages have had for years. Everybody and their brother has their own macro for this, but still, it's good to have this baked in.

  • Garbage Collection

    Another "Me Too!" feature, but it's a good one. Someday soon I hope to retire NSZombieEnabled.

  • 64-bit improvements

    There a bunch of really fucking cool improvements in the 64-bit version of the runtime, but I can't talk about those here because it is still under NDA. This is too stupid, because Objective-C can use all the evangelism it could get.

New Abstractions Wanted; Apply Within

It's pretty clear we've reached the end of the road for the consistent performance improvements we've seen with each version of MacOS X. They've done a hell of a job, but there is only so much you can do while maintaining backwards compatibility. Many of the cool new things in Leopard are opt-in rather than automatic. Apple will need to come up with new abstractions for developers to target in order to make significant progress on the performance front, especially in a multi-core world. The one exception is in language performance. They've only scratched the surface of what is possible with run-time and link-time optimization — in the relatively near future I think we'll see property access and some method calls faster in Objective-C than in C++. Run-time optimization beats compile-time optimization almost every time.

Food, etc.

With all the complaints about the bad food and rude security, I feel obliged to chime in. The food was much more pre-packaged than in the previous two years I'd been there, but I have to say I though the much-maligned pre-packaged salads and wraps were tastier than the hot buffet-style food served the first two days. Personal preference, I guess.

I felt more affronted by the security presence inside the conference. I can understand needing badges to get into the conference center, but having conference minders checking badges at every bottle-neck was really annoying, and I didn't appreciate getting yelled at just because I was daydreaming zombie-like while waiting in line to enter a morning session. Apple could have easily provided better badges (either double-sided, or that don't easily flip around like the ones Sun had at the Java conference at Moscone East concurrent with WWDC 2004). I don't remember them being this paranoid last year. But at least they didn't have Russian security types with barcode scanners scanning everyone entering each session like they did three years ago. 1984 indeed.

Posted by coughlin at 4:58 PM

October 13, 2006

This American Life Podcast

Via Kathryn Yu comes news that This American Life has a podcast.

The podcasts are free for one week beginning the Monday after broadcast.

This means I can now abandon rawavrecorder and probably illegal curl hacks to get the show on my iPod. With Democracy Now podcasting for more than a year now, this leaves only Fresh Air left on my list of Must Hear Radio without a podcast.

Posted by coughlin at 1:54 PM