Live data from Hacker News

If you're just going to sit there doing nothing, at least do nothing correctly

devblogs.microsoft.com

351–356 of 356 posts

Re: If you're just going to sit there doing nothing, at least do nothing correctly

#351

The point the critics of this piece seem to be missing is that there is not an exceptional case here that needs an error to be thrown. There are NO printers attached to the device (in this case by definition), and an app should cleanly handle that case, not crash. You wouldn’t throw an exception on a laptop just because it couldn’t reach the printer.

If you want a clear, modern example of a popular non-Microsoft product doing printer availability wrong, it's gnome-control-center.

Add a printer in Settings. While the printer is installing, click over to the "Color Profiles" tab. If you time it right, gnome-control-center will crash. If you dive into the details, you see that it was trying to enumerate the available printers (it knows one should be there) but that info doesn't exist yet. So it just crashes.

Thankfully, the fix is to just wait a few seconds for GNOME to finish installing the printer and restart Settings. Still, it's the principal app responsible for making your desktop work correctly as an end user with some unknown computing background. In a perfect world, this app should never crash.

It's hard to think about edge cases. It's even harder to imagine your handling of edge cases has its own edge cases. Right or wrong, at least the author is thinking deeper than "bad app, needs to be rewritten to support Wayland"

Re: If you're just going to sit there doing nothing, at least do nothing correctly

#352

Earlier quoted context omitted.

The Xbox can (and probably can do that while simulating the "user pressed cancel" dialog API for adding printers) but my understanding for what yungporko wrote was that the program would be the thing that lets the user know the xbox can't print.

The original article is about how the Xbox implementation of the Windows printing subsystem should behave, from one of its designers. They considered making it throw an Exception, but decided to instead behave as if printing is supported but there are no printers, so that Windows apps would not crash. My point was that, as an end user of such apps on Xbox, my preference would have been to have the Xbox OS tell me dir…

I do not have an Xbox to try but i do not see how these two are mutually exclusive. If you try to use an app to print you wont be able to do that because there are no printers. If you try to add a printer using the Windows API for adding printers (which AFAICT from the article is done via a GUI that Windows itself provides) then the Xbox OS could show an error message that Xbox does not have printer support and once you close it, have the API call the application made tell the application that the user cancelled the request (which is something, according to article, it already does - though i don't have an Xbox to tell if it displays an error message or silently returns the cancel code).

Xbox cannot tell you that there is no printer support before you try to do something related to printing because it doesn't know you may want that. An application that was made for Windows also can't do that because on Windows you can add printers (even fake ones that print to PDFs, no hardware needed).

Re: If you're just going to sit there doing nothing, at least do nothing correctly

#353

Earlier quoted context omitted.

The original article is about how the Xbox implementation of the Windows printing subsystem should behave, from one of its designers. They considered making it throw an Exception, but decided to instead behave as if printing is supported but there are no printers, so that Windows apps would not crash. My point was that, as an end user of such apps on Xbox, my preference would have been to have the Xbox OS tell me dir…

I do not have an Xbox to try but i do not see how these two are mutually exclusive. If you try to use an app to print you wont be able to do that because there are no printers. If you try to add a printer using the Windows API for adding printers (which AFAICT from the article is done via a GUI that Windows itself provides) then the Xbox OS could show an error message that Xbox does not have printer support and once…

An application asks the OS for the list of printers. The question is what should an OS with no support for printing do. The article says it should return an empty list. My point is that it should pop up a notification directly to the user telling them "hey, the app you're using is trying to access printing, but that's not supported on this machine" or some other language like this (it could then return an empty list).

Re: If you're just going to sit there doing nothing, at least do nothing correctly

#354

Earlier quoted context omitted.

I do not have an Xbox to try but i do not see how these two are mutually exclusive. If you try to use an app to print you wont be able to do that because there are no printers. If you try to add a printer using the Windows API for adding printers (which AFAICT from the article is done via a GUI that Windows itself provides) then the Xbox OS could show an error message that Xbox does not have printer support and once…

An application asks the OS for the list of printers. The question is what should an OS with no support for printing do. The article says it should return an empty list. My point is that it should pop up a notification directly to the user telling them "hey, the app you're using is trying to access printing, but that's not supported on this machine" or some other language like this (it could then return an empty list)…

Trying to enumerate printers doesn't imply that the application will use them, it could easily be part of the initialization of some framework, shared library, language runtime, or whatever. Unless there is some actual user interaction, there is no way for the OS to know what the user is trying to do. It is best to err on the side of not making assumptions.

Re: If you're just going to sit there doing nothing, at least do nothing correctly

#355
post #133

Earlier quoted context omitted.

User spends two hours creating content. User hits print. 1. App crashes back to the desktop/Home Screen/etc 2. App can’t find any printers. User cancels and saves the document, prints elsewhere. You really think option 1 is better? Also, none of this precludes the ability to display a message. He’s talking about the system calls themselves and how they should respond. I suppose if the call for the “Add Printer Wizard…

> 1. App crashes back to the desktop/Home Screen/etc Why do think it would crash, rather that simply return to main loop?

It might return to the main loop if you throw a NoPrintingOnXboxException… if and only if the author of the app has decided to catch a broad enough exception in that exact place in the code, and handles it gracefully. Good practice to always handle any exception that might be thrown, but it’s not always obvious in the past where there might be a chance for an exception to be thrown. For instance, the printing subsystem itself can’t be missing, can it??

So anyway, the platform vendor can’t be sure the above situation is perfectly handled by every app, so the entire point of the article is “given you must technically comply with the published API specifications, how can you construct the least harmful and least disruptive response to every request sent to this fully-removed system component.”

This whole exercise is basically constructed in order to usually guarantee the outcome you’re suggesting: to cause the app to just return to its normal functioning without doing the impossible thing.

Re: If you're just going to sit there doing nothing, at least do nothing correctly

#356

What a weird thread of comments this was. There are clearly people who just don't like anything Microsoft does. The point of the blog is to make the process of bringing apps (UWP) to XBOX be frictionless: no recompile required, no messy ifdefs, none of that extra work. The App would "just work". Then, it's up to the developers to start adjusting the app to fit the XBOX platform more. The important thing here is that…

I honestly feel like 95% of the people in this thread didn't understand the article.

for example, accusations of swallowing errors. That's not the point, not at all.

Post reply on HN