711 words on Software
There are a few things about Cocoa which can be quite annoying and which developers – and I won’t necessarily exclude ourselves here – frequently fail to get right. One of them is quitting an application. Quitting should be smooth and painless while taking good care of your data and making sure nothing is lost. While Cocoa applications usually get the safety thing right and won’t quit without letting you save your documents first, the smooth and painless part isn’t always as good as it could be. Particularly when the application uses sheets.
The problem with sheets is that a window with an open sheet will keep an application from quitting. That makes sense if you assume that sheets are critical UI elements. And, for sure, the most common sheet which asks you about saving your changes before closing a document is critical. You absolutely need the user to answer that question before you can proceed.
However, quite a few other sheets are not critical at all. Some of them wait for the user to enter some data, e.g. iChat’s Add Contact sheet or UnicodeChecker’s Find sheet. Others contain status information such as ‘HI I HAS FINISHD’ messages displayed after some action was completed, for which the sheet when Sandvox has finished publishing is my pet example. None of these sheets are essential and I don’t think that any of them should keep the application from quitting. Yet, the majority of such sheets (and the examples given) do just that.
I like to think that this behaviour is mostly due to Cocoa not assisting developers enough here. Developers have to make an extra effort if an application’s quit command is to dodge the non-essential sheets. And they probably don’t think of their application’s quitting behaviour as a high priority. It would make things much easier if sheets had a separate property that marked them as ‘critical’. And if all sheets that didn’t have that property would be automatically dismissed if their owning window wants to close. But that isn’t the case, and thus we keep seeing all those unfortunate sheets.
Looking at some of Apple’s revamped X.5 applications like Quartz Composer or Automator which like to baffle you with window sporting a huge sheet just after launching suggests that at least some people at Apple are aware of the annoyance sticky sheets can be (which admittedly is much bigger for applications that open a sheet as their first action after launching). So perhaps there is hope for the future.
Of course sheets have other problems outside the area of quitting applicatins. That is particularly true when they are used together with Exposé, where you might end up with a sheet in the middle of your screen while its window is out-of-sight in Exposé land. But at least in X.5 Apple’s own application acknowledge that it’s perfectly OK to have two sheets on top of one another attached to a window. Something that used to work in previous OS versions but was frowned upon by Apple.
Another thing that has puzzled me for a while with respect to the quitting behaviour of Cocoa applications is how the menu’s Quit command can possibly differ from a Quit command that comes in via AppleEvents. Shouldn’t both be exactly the same? And if they aren’t, does this point to a structural weakness of Cocoa or of the application’s programming? Just wondering.
I can stay with the examples I had before here. One is the Quartz Composer application: Launch it and it will present you an empty document with a sheet to select a starting point. Using the Quit command from the menu will correctly close the document and quit the application. Using the Quit command from the Dock will do nothing.
Similarly, Sandvox differs in its behaviour when quit in different ways: When using the Quit command from the application menu, Sandvox will store your current state of editing and when you open the application the next time it will automatically re-open the documents you were editing previously. Neat. But if you quit the application via the Quit command in its Dock menu, this won’t happen. Sandvox will simply quit and the next time it launches, no document will be opened.
Received data seems to be invalid. The wanted file does probably not exist or the guys at last.fm changed something.