Live data from Hacker News

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

devblogs.microsoft.com

231–240 of 356 posts

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

#231

Earlier quoted context omitted.

Agreed this is akin to HTTP 200 {"error": "Not found"}

Not at all! It's like porting a program which expects there to be a TCP stack to a system which doesn't have one, and wiring up a component which responds to all HTTP requests with 404 instead of letting it hang on an infinite loop or crash. Say it uses a browser for rendering, but in the original you can also fetch websites, and the assumption is deeply baked into the code. If your choice is between playing whack-a-…

> responds to all HTTP requests with 404 instead of letting it hang on an infinite loop or crash

How is a 404 equivalent to not throwing an error? 404 would be like throwing the error and then not handling the 404.

And the equivalent of hanging and crashing in the xbox example would be hanging and crashing.

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

#232

I've learned this as "swallowing errors" and IMO it's a poor practice. Not only does it not solve the issue at hand (you cannot print on an xbox), but it actively hides how broken the software is, which makes bug discovery and testing much harder. This is one thing I like about Go's panic. You're mostly not supposed to use it or recover from it at run time. It serves as a great vehicle to blare loud sirens at testing…

This is something that Elixir nailed. The typical idioms for return types are `{:ok, ok_value} | {:error, error_value}`, for which callers can pattern match against and handle appropriately. If fail-fast is desired, many functions will also have a variant signaled by a postfix exclamation mark (e.g., some_function!(...)), that returns `ok_value` or raises an exception.

> This is something that Elixir nailed. The typical idioms for return types are `{:ok, ok_value} | {:error, error_value}`, for which callers can pattern match against and handle appropriately.

Agree this is a good pattern. Im not categorically against throwing errors but I like returning errors or the result and then having to check at the caller. Do this in typescript a lot.

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

#233

I've learned this as "swallowing errors" and IMO it's a poor practice. Not only does it not solve the issue at hand (you cannot print on an xbox), but it actively hides how broken the software is, which makes bug discovery and testing much harder. This is one thing I like about Go's panic. You're mostly not supposed to use it or recover from it at run time. It serves as a great vehicle to blare loud sirens at testing…

Think of it like an emulator. The goal of DosBox is to provide Doom with the environment it wants so that it will run. That will necessitate some amount of lying.

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

#234

I find nothing quite as frustrating as UIs that suggest a device could exist, but it's not there right now. I then have to spend time to discover that these devices are not supported, and that screen was just some mock someone came up with.

Perhaps the software author is to blame here then not Microsoft. Because they didnt handle the printer case. Where Microsoft comes in is that the software doesnt crash because the software provider didnt account for printers.

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

#235
post #30

Earlier quoted context omitted.

Sure, but you'd be more frustrated if your app just crashed. If the app is not prepared for printing not being supported, and printing just throws an exception, the app probably just crashes. That's bad. If the app is prepared for printing not being supported, it should be calling the explicit API to check if printing is supported, and then not displaying the UI for printing if it isn't. The article is not about thes…

To me, a better solution would be for the system to pop up a notification informing the user that printing is not supported on this platform, and then whatever other solution is OK.

Yes exactly, but Microsoft isnt the one who can implement that.

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

#236
post #211

Earlier quoted context omitted.

It has irked me for decades that when the internet connection fails, all you get is a message that it failed. But what failed? 1. the software on your computer 2. the computer's hardware 3. the ethernet cable or wifi 4. the switch 5. the router 6. the cable modem 7. the internet cable to your house 8. the ISP 9. the remote system you're trying to connect to Nothing has improved for decades.

I've been suffering that TODAY. "Connection Refused No Further Information" Well thanks pal.

I was getting the equivalent from my Roku box the other day, something like "no connection to the internet". Sigh.

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

#237
post #109

> With this behavior, when the app tries to print, it will ask the user to select a printer, and show an empty list. I see Microsoft has not learned from 30 years: https://www.reddit.com/r/hacking/comments/djvzd/windows_nt_l...

That os amazing

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

#238
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.

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

#239

Earlier quoted context omitted.

Due to the input device most people will use (controller), apps that work best on Xbox are those used to consume content like photos or videos. You might be viewing something and want to print it, but that's clearly not desirable enough for Microsoft to build print functionality into the Xbox UI.

I mean, it has USB ports. If I can plug it in, I'd like to be able to use it _somehow_ , even if that means installing another app that does direct port/device access or w/e . ie, it should be possible (but not necessarily super easy)

The explicit point of video game consoles is to be a locked down experience, not a PC. Hardware access is generally used for piracy, which game developers do not like.

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

#240

I missing what the magic is here. This seems like a long way to go for “we know that this device is an Xbox and Xbox doesn’t support printing, let’s tell the user” Only it doesn’t tell the user. It leads them down a path implying implementation is possible. On the other hand, I now know why so many issues I’ve troubleshooted on MS products end in tears and complete confusion as to why they wouldn’t just say “this is…

I agree. The author's description of what is "reasonable" sounds like a blueprint for many of my late nights struggling with Windows:

"apps that assume that printing works will still behave in a reasonable manner: You’re just on a system that doesn’t have any printers and all attempts to install a printer are ineffective."

Maybe the underlying assumption is that the users will give up before spending an "unreasonable" amount of time on these tar pit features.

Post reply on HN