Live data from Hacker News

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

devblogs.microsoft.com

321–330 of 356 posts

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

#321

Earlier quoted context omitted.

Just to add further context; this isn't apps being ported to an Xbox, they notionally need no porting; the Xbox is a "Windows" system. The only actor in this scenario is the platform developer figuring out how an existing API should behave if called in a context the authors very much didn't expect (who expects their Windows app to be run on an Xbox?)

I guess I'm confused then. Is the expectation that you can just run any Windows app on an Xbox, unmodified? I would think you'd have to at least change the UI

Yes, that is a thing the Xbox supports (for UWP apps, not every Windows app ever). The UI is indeed often not great.

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

#322
post #248

Earlier quoted context omitted.

But I was responding to a general statement.

And I still think you're wrong. If incorrect input can't be handled gracefully in a way that you can be sure nothing bad will happen, it's possible that crashing is the best option. But I think in most cases that just isn't what's going on. An unsupported API that makes a feature not work is just not a big deal. Lack of support, say, for a cryptographic primitive, could be a big deal, so you might choose to handle th…

And would you treat an API endpoint that's down the same way? Just silently ignore that a feature that's part of the user's workflow isn't actually working, that maybe only half of what was supposed to happen when they pressed a button actually happened?

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

#323

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…

>You're mostly not supposed to use it or recover from it at run time Are you serious? I thought a key principle of Go was to handle panics in a layered way at runtime

in my experience that's partly true (it's a judgement call and lies on a spectrum). Like a HTTP server should handle panics in handler code so as to not crash the other go routines handling requests. Or maybe a long running queue worker (eg reading off SQS) should recover from a single go routine handling a message (assuming it can recover and handle the next message successfully).

But it'd be way out of scope to put a recover block outside every function call just incase it did a runtime error: index out of range [1] with length . In this way its much different than try catch in languages that explicitly call out what they throw

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

#324
post #179

Earlier quoted context omitted.

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

So it 'simply returns to main loop'. I.e., the user hits [Print] and then it maybe flickers and goes back to the home screen. How in heck is that more useful than App reporting that "I can’t find any printers"?

Because "I can't find any printers" suggests that printing is possible if only you set up your printer correctly, rather than suggesting the print function doesn't work.

By showing that no printers can be found the app is misleading the user to think there's an issue external to the app that they need to solve themselves.

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

#325

Earlier quoted context omitted.

Add a parallel step there, somewhere, for DNS. My raspberry pi runs pihole but the hardware is failing somehow so the server crashes so DNS lookups fail. All existing connections are fine, direct IPs are fine, locally cached results are fine, but new lookups fail. It is somewhat fun to watch it happen.

Windows has a tool to diagnose network problems, and it's usually completely useless but I think DNS not working is something it does identify.

Windows has a button to diagnose failed internet connections, but it has never reported anything other that the internet connection doesn't work. It's pathetic.

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

#326
post #266
post #257

Earlier quoted context omitted.

Recruiters and large firms tend to ask for a Word file. I sent the plaintext file (minimal markdown) I used to generate the pdf to a recruiter recently. They directly asked for a docx instead.

Recruiters probably edit the file before passing it on to the actual business... Add some more buzzwords, remove direct contact information, obscure exact project details. Some recruiters play quite dirty business and likewise assume the worst of their customers.

That is exactly the complaint I got about my word-document-with-page-images. The recruiter couldn't work out how to edit it. I saw the CV they actually ended up sending to one of the workplaces I interviewed at. They had retyped it, and it looked awful.

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

#327

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…

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.

It's similar to when you try to print something, and nothing happens.

1. is the printer turned on?

2. is the printer out of paper or ink?

3. does the cable have a loose connection?

4. is it the wrong printer driver?

5. do you need to reboot windows?

6. do you need to power cycle the printer?

No help anywhere. You just try things one by one, sacrifice a small animal, and then maybe the printer gods will smile on you and the printer will print.

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

#328

Earlier quoted context omitted.

Good luck uploading your CV in PDF. I tried that a few times and got moaned at a load that my CV must be in Word format. In the end I converted the PDF into images, and created a Word document in OpenOffice (this was a while ago) with one page image per page. Got moaned at for that too.

Heh. A buddy of mine once applied for a Linux job and sent his resume as a PDF. They called him back: "OMG, you're the only applicant who didn't send a Word file. We're not worthy. "

Did he create the PDF in LaTeX?

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

#329

Everyone here is hung up on doing "nothing" and handling "errors" and I feel like the post does a poor job explaining how it is not just swallowing everything that's going wrong and going kumbaya. The actual context is that the author is doing emulation/compatibility for software that will not change, and that's very different from most contexts. This is especially confusing because Microsoft often blurs the line bet…

> There may be times where you need to make an API do nothing. It’s important to have it do nothing in the correct way.

> For example, Windows has an extensive printing infrastructure. But that infrastructure does not exist on Xbox. What should happen if an app tries to print on an Xbox?

It says nowhere that the context is doing emulation for software that will not change. You just assume that because it supports the position you like. In fact, everything written applies to a program that I might write tomorrow for an XBox, and try to print something. There is nothing that designates this behavior only for old, unmaintained software.

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

#330
post #242
post #5

Once upon a time it was considered a great strategy for browsers to make the best effort to display a page, even if the html code had errors. Just try to guess the author's intention as well as you can, and go ahead. Errors are bad. Users don't want errors. I thought we learned from that experience. Apparently not.

Go type in: Hello World! And see the errors that now show up because of the wisdom we gained… wait, it still renders alright? I guess we still have much to learn then. Or , there might be something to gracefully handling certain classes of errors while crashing on exceptional cases.

Not sure if you meant to use

as an example because it's well-defined as an optional closing tag.

This is a completely normal usage and some people even author their HTML like this. Granted this is part of the effort to standardize error handling.

That unclosed

will auto-close as soon as you start another paragraph or close it's parent element. Likewise this is how I do lists these days:

  
     One
     Two
  
The subsequent li's will close the previous and the bounding ul ends the last list item.
Post reply on HN