Solipsism Gradient

Rainer Brockerhoff’s blog

Browsing Posts in Development

It’s over and reactions have been coming in from everywhere. Many people were, to put it mildly, disappointed. So how did I do?

Hardware: I said “not likely but hoped-for”. No hardware announcement, and the stock fell about $4 as soon as this became apparent – the webstore was down, but apparently just for a general style makeover.

“OS X” SDK and consolidation: nothing, so no hardware development kit either. This is actually what I’m most disappointed about. No mention of OS X at all, as far as I could make out.

Leopard beta release on the ADC site: Steve said it’d be for attendees only but very few people heard exactly what he said. I still hope it’ll be out next week.

Apps included: little was mentioned, some changes are on the website now.

New Finder and desktop: well, not new, but a facelift. At least I got that one right, but it was very predictable.

ZFS: not mentioned. Blame Jonathan Schwartz.

Virtualization: none. I really hoped they’d have switching between Leopard and Boot Camp in the same way that Fast User Switching works. Instead, it seems they took the easy way out. You can set Mac OS X to “safe sleep”, boot into Windows, set that to “hibernate”, then switch back and forth without rebooting either. I wonder how long that takes – 10 to 15 seconds would be quite acceptable, I think.

.mac: it still lives, and the “back to your Mac” feature looks interesting. No Google, though.

So, even though I didn’t get many things right, it’s not too bad either. Let’s wait and see what trickles out from the real (read: developer) part of the conference. That said, the new Finder and UI stuff doesn’t look too shabby, and I’m still positive that on the developer side this is a very significant release. More as it happens…

Tomorrow WWDC begins and as usual there are many rumors and few certainties. I didn’t make it this year, unfortunately.

Of course possible ideas have been flying fast and furious, but as usual nobody else knows for sure what sort of new Steve Jobs will present at the Monday keynote. Still, here are my ideas about what might happen, or at least about what I wish might happen.

WWDC being a developer’s conference, it’s not usual for it to see new hardware released – the iSight, the Mac Pro and of course the Intel migration being notable exceptions. Still, I think that new iMacs and/or new displays aren’t completely unlikely to be a by-the-way item in the keynote, or perhaps might be announced a few weeks later. Certainly both lines have gone too long without an upgrade; personally I’d like to see new displays and iMacs sharing a front bezel; the iMac’s “chin” is certainly avoidable by now, and it would mean that the iMacs would be distinguished from the same-sized displays only by a deeper rear casing. Having iSight cameras in the displays would of course be a given.

Some people feel that we’ll see a new iPod and/or a new tablet/ultrathin MacBook line – there’ll certainly be no iPhone hardware announcements. I think this unlikely, except in the context of…

…OS X without a “Mac” in front of it. Yes, I do have hopes of seeing a generic “OS X” SDK; Leopard will either be OS X or we’ll have explanations of how Mac OS X and OS X relate. Currently we have a multi-layer OS with several distinct APIs that developers can code to, but they all ultimately are seen in a single GUI layer – the one formerly known as Aqua – and run on a unified hardware platform (the Mac). Possibly, from now on, we’ll also be able to code to several hardware platforms and several GUI surfaces; neither iPods nor iPhones will ever sprout mice and keyboards, and it will be years before desktops and laptops will be accessible from multitouch only. (Though it would be cool to have optional multitouch sensors on those hypothetical new iMacs and displays…) And, before I forget it, there’s also the simplified – in fact, iPod-like – interface on the TV, which would be yet another GUI surface to reckon with.

Of course to have a generic OS X SDK we’ll need development hardware to test stuff on. If it’s unsafe to let developers code directly for the iPhone, as Apple has repeatedly said, some sort of touch tablet might even be a viable development system. I suppose this mostly depends on larger screens/panels being available, and thinner screens and mainboards. Some of Apple’s recent patents point in that direction; the one about glueing together structural casings, for instance.

On the general software front, Apple is of course making an effort to put people into a position to code cool new stuff for when Leopard comes out in about 4 months. Hopefully this will extend to releasing the “final” beta of Leopard during or very soon after WWDC; keeping it overly secret would now be unproductive. So, all that stuff like resolution independence and core animation will hopefully be used by the new apps. Speaking of apps, some people are of course viewing Leopard mostly as a vehicle to see incremental improvements to Mail, Safari, iChat and so forth – a distinctly unexciting way of seeing in my opinion. I’m not really that interested in the apps that will come included in Leopard except as examples in using all the cool new APIs.

An exception is the Finder, the app that even for most developers is the “face” of the OS. Much wailing and gnashing of teeth has ensued when the past Leopard seeds showed a scarcely changed Finder; I do think (and hope) that we’ll see a reasonable facelift to it during the keynote, though perhaps a completely new Finder might be too much to hope for.

I’m reasonably sure that we’ll have ZFS as a formatting option for external hard drives, and it would certainly be neat if this option meshed somehow with Time Machine for more reliable/expandable backups, but I’m not informed enough about the technical aspects of that. I don’t think booting from ZFS is likely, especially after the recent leaking of that possibility by some folks at Sun – let’s just hope Steve Jobs doesn’t cancel it outright just to prove them wrong!

Virtualization, after being discarded months ago as an option, is suddenly rumored to be in the works again. The options seem to be: a Parallels workalike built into Leopard (unlikely), Apple buys Parallels outright (also unlikely), simply releases a final version of Boot Camp (a little more likely but utterly boring), or – the one I think possible, and have mentioned here before – Apple will build a virtual machine hypervisor into the firmware, running OS X and whatever Boot camp supports in multiple virtual screens.

The final item of interest is .mac. There’s an SDK for that and everybody, up to and including Steve Jobs, agrees that .mac is underpowered and behind the times. In the last few days it’s become more likely that the increasing collaboration between Apple and Google would extend to Google taking .mac under their wing. They certainly have more server power to do it; in my tests, .mac has always been so slow in Brazil as to be unusable.

So, that’s it for now. More after the keynote…

XRay update

No comments

It’s been some time since I posted updates on XRay. Quite recently MacUser UK published a mini round-up on Finder utilities where, somewhat to my surprise, XRay scored 5 out of 5 against 4 competitors – and also was “Editor’s Choice”. (If anyone has that specific issue – 4/2007 I’d be grateful for a scan of the printed page.) Not bad for an utility which hasn’t been updated for quite some time!

This prompted me to review my sales graph which I had somewhat neglected lately. Here’s the current curve, with annotations:

The initial spike for the 1.0 release is no doubt due to several months of public beta. I wouldn’t necessarily say this would be applicable for all cases; XRay is targeted towards developers and more proficient users. During the public beta period I released new versions every month or so and took great care in replying to any comments and suggestions. So there was a pent-up demand and a ready-made userbase waiting to register their copy in the very first week.

After that, of course, sales decayed exponentially with a slight recovery when the reasonably significant 1.0.5 release came out, with subsequent releases nearly or completely vanishing in the noise – I suppose most people who needed it had already registered. Some other blips are due to the software being included in CDROMs. Still, for the last 3 years sales have stayed reasonably flat with a slight upwards trend detectable since the Intel Macs came out; no doubt this just reflects the expanding market. There are a few peaks (marked with “??”) which I have no ready explanation for…

Still, XRay 1.1 (the current release) isn’t an universal app, though it still runs fine under Rosetta. The downside is that the XRay Contextual Menu doesn’t work, as it’s called by the Finder, which (on Intel Macs) works only with universal plug-ins. However, it’s still possible (and even faster) to select an item in the Finder and XRay it by pressing shift-command-X.

Of course, as I’ve said here now and then, XRay II (2.0) is in the works. Unfortunately the universe has lately conspired to keep me from making any significant progress; still, I’m seriously determined to have a public beta out before the year is over. Hopefully sooner. Maybe much sooner. Stay tuned.

Loldevs!

No comments

There’s this new Internet meme going around. Anil Dash has a good writeup.

So here’s my modest contribution, but with a mutant twist. I present to you… loldevs!!!!

If you’re a dev and have a blog, consider yourself tagged. Post a picture of yourself with a caption that fits one of the standard categories, and which alludes to something you’ve been blogging about. Non-devs should be unable to understand the result, of course…

More famous than I realized. David Paul Robinson writes:

Rainer Brockerhoff, long famous for being averse to version control, dips a toe into the svn waters…

Thanks for the link David. icon_wink.gif

Maybe I should do some marketing around this? “No version control system was harmed while building this software.” Heh. Charge extra for admission…?

Uli Kusterer, Blake Seely and Andy Finnell have posted follow-ups to Brent Simmons‘ comments on the topic. Worth a read, too.

Uli started his comment with:

Rainer Brockerhoff, the man without version control, has posted…

OK, I guess I should seize the opportunity to confess that in the past I have looked a few times into using Subversion (aka svn) for version control. Xcode currently supports cvs, svn and Perforce. cvs, by all accounts, is old, clunky and obsolescent technology, Perforce is commercial and expensive ($800 per user), so svn is the generally used solution.

Turns out that svn was written by Unix geeks who were unsatisfied with cvs and wanted more capabilities while keeping many cvs concepts and terms. (cvs itself was similarly evolved from the even earlier and clunkier RCS.) Unsurprisingly the whole family tree is exclusively command-line oriented and requires significant neuron grease to adapt to. As I’ve said before, I became sick and tired of command-line stuff in my early career and was extremely glad when, in 1984, I could migrate to the Mac where there was no such thing. Now that Mac OS X is Unix-based I do use the Terminal when there’s no alternative, but in general I try to avoid it. So I had a fast look at svn and its documentation, decided it wasn’t worth the trouble, and went on doing other stuff.

But over the last few days, with the generous help of several people – among them Matt Gemmell, Daniel Jalkut, Tom Harrington, Jeff Johnson and several others on the #macsb channel – I at least figured out enough to be able to set up a repository on DreamHost and tinker around with it. The first byproduct is now online: you can now check out RBSplitView from its own svn repository. Enjoy.

Does this mean that Subversion has now subverted me into doing all my future work under its benevolent dictatorship? No. Xcode 2.4.1 crashes seriously when I try to turn on the version control checkbox, at least for my most-important project. I have deduced that this happens because of some sort of data incompatibility between Xcode and the contents of the dozens of bothersome .svn folders that it insists in maintaining inside of the folders it controls. For simpler projects or older projects it works; for my XRay II project it doesn’t. Bah. For what it’s worth, Leopard’s Xcode 3.0 seems to have fixed this problem and supports many more svn features than the current version; so I’ll probably try this again in a few months (Leopard is still not stable enough to allow me to use it for actual work).

I was going to list a long series of stumbling points and oddball nomenclature that led to my spending several days (instead of hours) on doing these things that should be easy and “just work”, but I don’t think I’ll have the energy for that. Significantly, there’s no complete Subversion GUI client available for the Mac – or for any other platform, I believe. Apparently any hypothetical geek with the necessary masterful understanding of the subversion client and server will by definition also be convinced that a GUI interface will be wimpy and superfluous. (He will probably also believe the same of Xcode.) Also, the server side is seriously lacking in functionality; you can’t do things as simple as wipe a repository or exclude files committed by mistake.

To explain my feelings about svn at this point, I’ll try to reproduce from memory one of Isaac Asimov’s favorite jokes, “Levine the tailor”. I think it’s in his autobiography. You may substitute any other name you find hilarious. (I also wish I’d somehow filmed Háj Ross when he first retold me this joke.)

Morris went to Levine the tailor to have his first suit made. Levine took the necessary measurements and told him to come back in a couple of weeks. Back at the tailor’s shop, Morris tried the suit on and found that it was a little roomy around the shoulderblades. He called attention to that, and Levine replied:

“No problem. Simply hunch your shoulders out a little and look down, and the problem will go away.”

Morris did so, but upon looking down, noticed “Hey, the left arm is crooked!”

“No problem, just hold your left hand like this [demonstrates] and twist your elbow out a little. You see? It’s gone!”

Morris again did so, but then looked further down and said, “And this trouser seam isn’t straight either!”

“Still no problem, just swing your heel on that side out just so and all fits perfectly!”

So Morris pays and leaves the store wearing his new suit, feeling slightly duped by the tailor. An elderly couple watches him lurch by [you should demonstrate this while telling the joke]. The woman says “Isn’t that young Morris? He must have been in some serious accident. He’s all bent and twisted!”

And the man replies: “He must have been, but his tailor is certainly a genius, to make such a perfectly fitting suit!”

Brent Simmons has a long and thoughtful post about his way of doing large Cocoa projects. By all means read the original post and the comments. (Good reactions from Michael Tsai, Daniel Jalkut, Wolf Rentzsch, Blake Seely, I must have missed several others.)

Brent highlights some points: don’t overuse notifications, don’t overuse Key-Value Observing, bindings may be overkill for tables and outlines, C functions for global interfaces, flat source folder organization, learn tricks for fast project navigation. I agree with most. My own largest project is nowhere near’s Brent size of 345 .m files – perhaps also because I don’t mind larger files – but it’s not much simpler than NetNewsWire either. Anyway, bear in mind that my comments below just detail what works for me. YYMV and so forth.

Notifications. Everybody seems to agree they’re not a panacea. I listen to some Cocoa notifications and practically never generate my own. Notifications are great for posting notice of some application-wide event in the hope that some other parts of the application will want to know about it. That’s usually the case when some parts don’t know about other parts, or when one of the parts is a generic framework.

Like Brent, I prefer to use delegates for fast and specific notifications. Say a custom view is resized and someone needs to know when that happens; the logical pattern is to implement a delegate for that view and call it directly. Simple, fast, and easy to trace through. “Easy to trace through” is in fact my main debugging mantra. The bad thing about notifications is they’re difficult to step through in the debugger; you need to place a breakpoint at every listener. The obvious advantage over delegates is that you can have more than one listener – not that I ever needed more than one.

KVO and bindings: I haven’t had occasion yet to use those, although I’ll probably do so for preferences in XRay II. I tried using them in my first plug-in there but backed off fast; they’re certainly not suited to handling nested views that may be loaded and unloaded; the retain cycles get unmanageable. They’re also impossible to properly visualize in the current Interface Builder (though it seems that will change in Leopard?) and even harder than notifications to step through in the debugger. So I’d rather wait for a suitable application to present itself.

I suppose I also should point out that the upcoming Objective-C 2.0 properties look, so far, like another brilliant idea well-suited to specific purposes but not useable elsewhere. The property declaration syntax looks terrible, and the dot notation looks like Java. I can’t see myself using this any time soon – also, notice that the compiler will generate accessor code for them, meaning, you can’t step through.

High-level interface: in my first programs I noticed that I was jamming lots of methods into the application delegate. The app delegate is a singleton, so my other classes were full of lines like [[MyAppDelegate sharedInstance] checkSomethingWith:someStuff]. Later on I changed those to class methods like [MyAppDelegate checkSomethingWith:someStuff], and nowadays they’re just global C functions. I agree they may make it more difficult to refactor the design under certain circumstances, but after a while you learn to look ahead when deciding which functions to use. The only singleton object I have these days is the application delegate.

By the way, I use C functions a lot. Anywhere I see an instance method which doesn’t use “self” or any instance variable, it’s better to convert it into a C function. Same for most class methods. A bonus of C functions is that they’re harder to hack, of course.

Project Navigation: like Brent, I use the function popup a lot. I rarely have so many methods that sorting them into groups with #pragma mark is necessary. I use command-doubleclick and option-doubleclick a lot, and I keep AppKiDo open all the time. I noticed only recently that Xcode has a scripts menu with useful scripts and shortcuts, but the only one I use much is command-/ to comment and uncomment.

By the way, many people rave about using TextMate instead of Xcode for code editing. Apparently nearly all of those people are emacs fans who hate grabbing the mouse and prefer to do everything with memorized key shortcuts. Of course I’m an old fossil who still remembers the WordStar shortcuts and my shortcut neurons seem to be unable to learn new ones; I use the keyboard for cut, copy, paste and save, type short changes with my left hand, and for everything else I resent anything that forces me to take my right hand off the mouse. After all, that’s why we use Macs, right? </slight exaggeration for effect>

But then I suppose most of those people also like compiling their projects in the Terminal… Brent says, “Every time you touch the mouse, God kills a kitten”, but I’d say that for the command key instead icon_smile.gif

Flat folders: Yes, I too have a huge flat folder organization and 1 or 2 levels of grouping in the Xcode project. I never look at most of those files outside of Xcode anyway. I also include my readme and documentation files into the project, and edit them there (I create them in TextEdit however). Some people say this makes reusing code and source repositories harder. I prefer duplicating files or swatches of code when reusing; with some exceptions like RBSplitView, which I include as a subproject.

I seem to be notorious for not using version control systems; currently I keep my source on both my desktop and my laptop, and backup the entire project folder to a new disk image now and then. I very rarely need to refer to older versions anyway – I tend to comment out code instead of deleting it. I may try out Xcode 3’s subversion support, hopefully it won’t make me use the Terminal for anything. Of course, I’ve never worked in a programming team or had to share code with somebody else; blame it on history.

Cocoa quickie

No comments

Borkware Quickies is a highly recommended collection of small, useful code snippets. Mark Dalrymple has been so kind to post one of my own there: “Making naked memory autoreleased”. Here’s a shorter and even more useful, though sometimes slower, version:

static void* tempCopyOf(void* data,UInt32 size) {
   void* buffer = calloc(1,size);
   if (buffer) {
      if (data) bcopy(data,buffer,size);
      [NSData dataWithBytesNoCopy:buffer length:size freeWhenDone:YES];
   }
   return buffer;
}

So, you can call this as:

void* thing = tempCopyOf(&myStructure,sizeof(myStructure));

which will give you a temporary copy of myStructure, or as

void* thing = tempCopyOf(NULL,someSize);

which will return a zero-filled buffer of someSize for you to fill in as you want.

Photos licensed by Creative Commons license. Unless otherwise noted, content © 2002-2025 by Rainer Brockerhoff. Iravan child theme by Rainer Brockerhoff, based on Arjuna-X, a WordPress Theme by SRS Solutions. jQuery UI based on Aristo.