I think I did you a disservice with my theme description, I think all of your pictures would qualify as unexpected! I was a bit vague because I didn’t wanna dampen creativity, but I fully considered “astronauts that aren’t human” to be unexpected to a (hopefully) human audience.
The Justice Department has determined that Boeing violated a settlement that allowed the company to avoid criminal prosecution after two deadly crashes involving its 737 Max aircraft, prosecutors told a federal judge on Tuesday....
I mean… The account exists if you log into it or not. You still need to keep track of it so that you’re paying into the correct account, and so that you know how much to pay.
Only you now have to talk to a person if you need to check or change anything.
My VPN sometimes sends me reminders and special offers when my contact is almost up, for example. Mobile phone data usage reminders and warnings. Even just reminders that they’re going to be charging your card on payment day.
But mainly I don’t wanna leave home so paperless has already won for me lol
Designing for micro services doesn’t mean you need to deploy it as micro services. You can deploy it as a monolith and configure it too skip the network stack
If your function is so long that keeping track of returns becomes burdensome, the function is too long.
I’m not a fan of returning status codes, but that’s a pretty clear example of early return validation where you can’t just replace it with a single condition check. Having a return value that you set in various places and then return at the end is worse than early return.
You said yourself they’re equivalent. You either have to read the blocks in both cases or neither case.
You need to read the blocks to know what gets returned (either early or in a single return). You need to read the blocks to see what resources get created but not released. What are you hoping to achieve by only reading control flow?
At least with an early return you can stop reading.
What are you hoping to accomplish by only reading control flow and not the contents of the blocks? You keep raising concerns like not properly releasing resources, but if you don’t read the blocks you don’t know what resources we’re allocated.
I think your argument depends on both having your cake and eating it.
If you’re reading the control flow, and the control flow tells you the first block isn’t being entered, then it doesn’t matter if the first block contains an early return or not, because it wasn’t being entered. If it was being entered then you have to read it anyway to make sure it’s not manipulating state or leaking resources.
To use your example: in subsequent reads, when I’m interested in the second block out of n, say during defect analysis, I can head straight to the second block in either case since control flow shows the first block was skipped - but in the case of early return from the second block I can stop reading, but in the case of a single return I need to read the flow for all subsequent n blocks and the business logic of any subsequent blocks that get entered. The early return is a guarantee that all subsequent blocks may be ignored.
To me this is also obvious. I’ve been doing this for quite a while and 95% of the time, reviewing and debugging code with a single return is far more tedious.
Have you stopped to consider why you can’t explain it better? Perhaps the reason is because you’re wrong.
Your toy example does not show the issue you think it shows. You’ve moved your cleanup block away from the context of what it’s cleaning up, meaning that you’ve got variables leaking out of their scopes. Your cleanup code is now much more complex and fragile to changes in each of the blocks its cleaning up after.
You tried to use your toy example to show A is better, but then we showed that actually B is just as good. So fix your toy example to show what you actually want to say, because everything you said so far depends on you setting different standards for each scenario.
[Community Challenge 35] Unexpected Astronaut (lemmy.ca)
Theme...
Justice Department says Boeing violated deal that avoided prosecution after 737 Max crashes (apnews.com)
The Justice Department has determined that Boeing violated a settlement that allowed the company to avoid criminal prosecution after two deadly crashes involving its 737 Max aircraft, prosecutors told a federal judge on Tuesday....
Check your email for the verification code we just sent you. (lemmy.sdf.org)
Let's do micro service (sh.itjust.works)
Ancient problems require ancient solutions
'Let her go! Let her go!' Fontana officer shoots armed man who put his partner in a headlock (www.yahoo.com)
Seconds later, a shout rang out: “He’s got a gun!”...
Rex Murphy, the sharp-witted intellectual who loved Canada, dies at 77 (nationalpost.com)
As he battled cancer, Murphy continued to file, writing about Hamas and Christmas and interviewing Pierre Poilievre with his usual panache
got him (lemy.lol)
Womens fashion guide (lemmy.world)
Which one? (sh.itjust.works)
[Community Challenge 34] Fashion (sh.itjust.works)
:::spoiler Prompt a fashion photo shoot, of an orc in a colorful zoot suit, full-body shot —style raw —ar 3:4 —stylize 75* :::...
Funniest title wins (lemmy.world)
[Community Challenge 33] Cozy Catastrophy (lemmy.ca)
Theme...